问题
I am making an app that simulates a keyboard. I will do it by sending WM_KEYDOWN to a window, but I am not sure where to send the message. to the currently active window or to HWND_BROADCAST?
Here is an other question I posted, related to this one.
If I send a WM_KEYDOWN message (using wndproc) will the computer hold the key down until I send WM_KEYUP?
回答1:
If make a generic virtual keyboard and not worry about which window is active (which is the window manager's business), you can use SendInput: http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspx
来源:https://stackoverflow.com/questions/2090058/i-want-to-make-a-virtual-keyboard-do-i-need-to-send-wm-keydown-to-the-current-a