How to detect the input device if mouse and touchpad are both enabled

后端 未结 6 1564
小鲜肉
小鲜肉 2021-01-15 12:14

I already have a WH_MOUSE_LL hook in my application, but need a different behavior for Mouse and Touchpad.

I know about Raw Input API, but have no idea how to use it

6条回答
  •  醉梦人生
    2021-01-15 12:47

    You could use Raw Input to register for devices that you are interested to receive input from if you want to receive input for only the Touchpad, the Mouse, or both. You just need to register to receive input from the devices of your interest using the RegisterRawInputDevices function. this Microsoft docs example explains how to do this for a mouse and keyboard. Listening for Touchpad input would require a similar approach. you would use page 0x0D and usage 0x05. As for using this API with hooks, the AbsoluteTouchEx repository could provide some guidance on how to do this.

提交回复
热议问题