Skip to main content
GameDev.net gamedev.net
🔒 Locked

Enumerating Mice/Keyboards C++

Started by CJWard Apr 3, 2011 at 5:15 PM 2 replies 1.6k views
Original Post
CJWard
CJWard
I am trying to enumerate the present mice and keyboards on a system so I can listen to them individually. Using RAW input I get a unique device handle, which is useful, however, I want to enumerate all the possible mice and keyboards at application startup, which can then be linked with the handles received in the WM_INPUT message. I've examined the SetupDi functions and haven't found anything that can get a device handle, Is there another set of functions which can enumerate devices and link them with handles.
Krohm
Krohm
Is [font="'Courier New"]SetupDi [/font]related to DirectInput? I don't remember as I haven't used it in a while for a reason. It's old, overly complicated and deprecated as far as I've understood. Don't use DirectInput unless you absolutely know what you're doing.
If you are already using RAW input, just call GetRawInputDeviceList a few times and you should be done.
Previously "Krohm"
CJWard
CJWard
Thanks for the help, I'm not sure how I overlooked this. However, I'm now currently stuck with the problem of having an awkward looking name of a device.

eg: \\?\HID#VID_0D8C&PID_0102&MI_03#7&2caa9a5d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

How can I convert from this GUID(?) and some other stuff to a name that is more coherent to a user?
Coriiander77
Coriiander77
Why are people still using DirectInput for keyboard and mouse input while Microsoft itself strongly advises not to?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.