How I can send a Ctrl + P to window if i khow a handle of this window?
I think that i must use
PostMessage(hWnd...
Upon further investigation, the SendInput Windows API call may be what you require? http://msdn.microsoft.com/en-us/library/ms646310.aspx
Consider using ControlSpy and, as Thomas Sampson says, check what messages are sent when you press Ctrl-P. After that you can use PostMessage and reproduce this behaviour. However , do check the state of a WM_CHAR and what you need to fill in. That's a lot. This is why they created keybd_event
, which has been superseded by SendInput . But, as I noticed, this does not specify a handle to which you can send the information.
Which leads me to the question : are you sure you are addressing your issue the correct way? If you want the program to print, you might want to check for other ways to make the program print, for instance defining your own WM_USER+x
message that you can handle without simulating keypresses
这是一个(旧的)win32常见问题解答...(> 16年),您可以在Professional Win32新闻组新闻中看到此消息:: //nntp.aioe.org/comp.os.ms-windows.programmer.win32
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.