Is it possible to swallow a key in Raw Input?

前端 未结 3 1425
故里飘歌
故里飘歌 2021-01-13 09:24

I am using the Raw Input API because I need to be able to respond to keys from different USB HID devices differently, even if it is the same key.

My

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 10:10

    The Raw Input API does not support swallowing of keypresses.

    Furthermore, it does not interact with SetWindowsHookEx within the same process. As soon as the Raw Input API is initialized, the hook is unhooked.

    The solution is to have them in separate processes. One process can use SetWindowsHookEx to swallow the unwanted keys, while another uses the Raw Input API to process the keypresses that do come through. Then you just run both. This worked just fine for me.

提交回复
热议问题