开发者

Low-level keyboard hooks to inspect source device ID

开发者 https://www.devze.com 2023-04-06 22:34 出处:网络
I know there are good articles and questions 开发者_C百科on installing keyboard hooks already, but I\'m interested to know if and how it\'s possible to inspect the source device ID?

I know there are good articles and questions 开发者_C百科on installing keyboard hooks already, but I'm interested to know if and how it's possible to inspect the source device ID?

The idea would be to ignore any keyboard presses from the main keyboard, but hook any that come from a barcode scanner (which, if you didn't know, pretends to be a keyboard as far as the OS is concerned).


Check this article. It looks like it's not possible through keyboard hooks. He used the Raw Input API.


Raw Input (C# Example) can do this.

I had a play with that code with my own basic keyboard-wedge barcode scanner & found that in order to register events I needed to remove the if (rid.dwType == RIM_TYPEKEYBOARD || rid.dwType == RIM_TYPEHID) filter so something needs tweaking.

If I did remove the restrictions it was successfully registering keyboard+scanner input and reporting different device details for each.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号