问题
I would like to block all keystrokes that are coming from a specific keyboard (identified by its HID/Name, so its low level stuff I guess) before they reach the focused application. But I'm still using this disabled keyboard (I'm getting the keystrokes). I think I need an application's hook but I don't know how to do that. Maybe you can give me some useful link?
Regards,
EDIT:
I think I need a low-level hook, because general hook (I mean hook all the existing window & threads) aren't available in the .net framework, concerning the user-space. Moreover, I use RAWINPUT to get typed keystrokes from the keyboard. So if I make a hook to block keystroke from a specific device, could the hook block the RAWINPUT as well?
回答1:
An application can distinguish the source of the input by getting raw input data. However the application needs to handle WM_INPUT instead of WM_CHAR, WM_MOUSEMOVE, or WM_APPCOMMAND.
来源:https://stackoverflow.com/questions/12885897/block-keystrokes-from-a-specific-keyboard