Register Only Specific Devices
I have a WPF application that has one or more HID keyboard devices connected. Is there a way to register ONLY these devices (and not the regular keyboard) with RawInput? I see there is an UnregisterDevice method, but it only works for specific "types" of device; for example, I could call it like this:
RawInputDevice.UnregisterDevice(HidUsageAndPage.Keyboard);
Unfortunately, this unregisters ALL keyboard devices.
What I would like to do is loop through registered devices and Unregister those which are NOT of a specific (VendorId, ProductId). Better yet, I would like to get a list of HID devices and register ONLY devices with a specific (VendorId, ProductId).
Any ideas how I can accomplish this?
UvotGuy
RegisterDevice and UnregisterDevice are wrapper for the native RegisterRawInputDevices.
This function only allows specifing device "types" by Usage and Page.
Instead, you need to check the RawInputDevice.VendorId / RawInputDevice.ProductId, which can be acquired by RawInputData.Device property.