Active HID mouse or touchscreen detection RRS feed

  • Question

  • I have two USB touchscreens or mice connected to a PC.  I need a way of detecting which of the two touchscreens was last touched via its HID PID, VID or port.  What makes it difficult is that the app that needs to be detecting this will be minimized so will not have the focus i.e. it will not be active.  I have experimented with some samples I found online using the RAWINPUT approach with two USB keyboards but that requires the app to be active in order to receive the keyboard events. 

    The OS that this app will need to run on is both Windows 7 and 10.  Or if there is a way to detect which of the two USB HID devices is currently active.  I am not looking to capturing any data from the device but just to know which of the two devices is currently sending data. 

    Is there a way of doing this using C#?  


    Wednesday, October 3, 2018 4:31 AM

All replies

  • The term "currently active" has no meaning.  They're ALL active.  Their inputs are all blended into one queue to be sent into user mode.

    Have you tried registering for raw inputs?  I didn't think focus was a requirement.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Wednesday, October 3, 2018 11:21 PM