Question

I am trying to create an application that reads keyboard input from a HID. The OS I am trying to acheive this on is Windows 7. In what way would I specify to my program that it needs to listen to just one HID device (I have a normal keyboard, and an RFID reader as my two devices) Could some one tell me the best route to take if I wanted to just listen to one HID and ignore other keystrokes (From the keyboard)

Was it helpful?

Solution

Did you register for HID input with RegisterRawInputDevices() ? Because in that case, you tell Windows for which devices you want "raw" input.

[edit] Rough sketch:

int count = 0;
GetRawInputDeviceList(0, &count, sizeof(RAWINPUTDEVICE);
std::vector<RAWINPUTDEVICE> devs(count);
GetRawInputDeviceList(&devs[0], &count, sizeof(RAWINPUTDEVICE);
// Select device(s) you want
RegisterRawInputDevices(&devs[0], &count, sizeof(RAWINPUTDEVICE);

OTHER TIPS

You should probably handle the WM_INPUT message and check hDevice in the lParam input structure. See http://msdn.microsoft.com/en-us/library/ms645590%28v=VS.85%29.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top