Search code examples
c#keypress

Get VID And PID from keypress


Does anybody know if it's possible to get the VID and PID from a keypress event in C#?

I've been searching, and seems like it's possible with C, but I can't find any examples for C#.


Solution

  • I assume that you are looking for the VID (Vendor ID) and PID (Product ID) of the USB device that generated a keypress. There is no direct support for this in C#, so you will need to use P/Invoke to access the C "raw input" API.

    Here are two examples to start from: