简体   繁体   中英

keyboard event generation question

I have to send a keyboard event from my console app with character code nChar and event code nFlags : SendKeyboardEvent(UINT nChar, UINT nFlags)

For MFC dialog this function would be mapped to some event handler so I wouldn't have to worry about nFlags at all. Can someone point me to how I could obtain that value for the console app?

If you're trying to simulate the keyboard in another application, the function you should be using is SendInput() or at least keybd_event(). Keep in mind you have to set the focus window first or else your input won't go where you expected.

SendInput(): http://msdn.microsoft.com/en-us/library/ms646310

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM