I have two keyboards connected to my PC, is there any way to know what keyboard a key was pressed on in any language or framework?
+3
A:
For Windows, you can register you application to receive raw input notifications with the RegisterRawInputDevices API. Once you register, your application will start receiving WM_INPUT messages. The lParam to that message is a pointer to a RAWINPUT structure. You can use the GetRawInputData API to get the header in the form of RAWINPUTHEADER structure. Then you can use the GetRawInputDeviceInfo on the device handle from the header to extract information for the device that generated the input.
I am not aware of other ways to get the device that generated the keyboard input on Windows.
I also have no idea how to address that problem on any other operating systems.
Franci Penov
2008-10-20 08:14:38
Thank you! GetRawInputData is above bellow or at tehe same level with DirectInput from DirectX?
Ovidiu Pacurar
2008-10-20 08:18:30
Does anyone know the solution on linux for this? It'd be interesting to know. :)
Cheery
2008-10-20 08:39:21
To be honest, I am not sure how raw input relates to DirectInput.
Franci Penov
2008-10-20 08:44:53