Search code examples
.netwinapivisual-c++wdk

How to know which mouse has generated MouseEvent that is received by my application?


I have two mouse devices attached with my PC. So I want to detect which mouse has generated actual mouse event that is received in my application. You can simply think your laptop having track pad and usb mouse. I want to differentiate mouse event generated hardware.

I want this information in .Net Application. But I can use P/Invoke if Native Windows APIs are available. I am also interested with other solutions like Windows Mouse Hooks. But I don't know whether it works or not.


Solution

  • To distinguish events from different mice you can use use Raw Input. I don't think this has a .Net interface, so you would have to use P/Invoke.

    The MultiPoint Mouse SDK claims to make it simple to use multiple mice on a single PC. I've never tried it, but it does have a .Net interface.