Is IDirectInput8::FindDevice totally broken on Windows 7?
- by Noora
I'm developing on Windows 7, and using DirectInput8 for my input needs.
I'm tracking gamepad additions and removals (that is, GUID_DEVINTERFACE_HID devices) using the DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE messages, which works fine.
However, what I've come to find out is that no matter what I do, passing the received values from DBT_DEVICEARRIVAL to IDirectInput8's FindDevice method, it will always fail to identify the device, returning DIERR_DEVICENOTREG.
DirectInput still clearly knows about the device, because I can enumerate and create it just fine.
I've tried with three different gamepads, and the error persists, so it's not about that either.
I also tried passing some alternative interface GUIDs for the RegisterDeviceNotification call, didn't help.
So, has anyone else faced the same problem, and have you found a usable workaround?
I'm afraid I'll soon have to stoop down to re-enumerating all devices when something is added or removed, but I'll first give this question one last shot here.
EDIT: For the record, I've also tried pretty much every single HID API & SetupAPI function for alternative ways of figuring out the needed GUIDs, with zero success. So if you're facing the same problem as me, don't bother with that route. I'm pretty sure those GUIDs are made up by DirectInput itself somehow. Short of reverse engineering dinput8.dll, I'm truly out of ideas now.