简体   繁体   中英

How to detect if keystroke was emulated by keybd_event or SendInput?

是否可以在我的自定义 Win32 控件中检测到,在处理WM_CHARWM_KEYDOWN消息时,击键是来自实际键盘,还是通过调用SendInputkeybd_event类型函数来模拟

You could check if the LLKHF_INJECTED flag is set in a low-level hook. I don't think you can tell just by looking at the LPARAM.

Starting in Windows 8, you can use the GetCurrentInputMessageSource() function in your message handler. You can check if the reported originId is IMO_HARDWARE , IMO_INJECTED , or IMO_SYSTEM .

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