Determine which mouse was clicked (multiple mice devices) in .NET

后端 未结 1 1393
被撕碎了的回忆
被撕碎了的回忆 2020-12-17 18:51

I want to detect when my touchpad is clicked!

I normally use a usb mouse, so I don\'t use the touchpad for anything. Instead I\'d like to make it possible to perfor

相关标签:
1条回答
  • 2020-12-17 19:42

    Have a look at the RawInputSharp library from this page. It uses pInvokes into User32.dll to get hold of input device information. Using it you can detect which device (ie. mouse) input is coming from.

    Having had a little play with it, I managed to extract some code that displays just the device id - a different value depending on whether I use my USB mouse or my internal touchpad. The tricky thing would be to identify which device id is that of your touchpad automatically, but you could manually configure this in your application.

    0 讨论(0)
提交回复
热议问题