Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect which of multiple keyboards #2

Open
sancarn opened this issue Mar 31, 2021 · 0 comments
Open

Detect which of multiple keyboards #2

sancarn opened this issue Mar 31, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@sancarn
Copy link
Contributor

sancarn commented Mar 31, 2021

It would be really useful if we could attatch which keyboard the keyboard event came from to the event as this would open up a lot of possibilities.

It appears that this is described here

  1. Register the devices you want to use for raw input (the two keyboards) with ::RegisterRawInputDevices().
  2. You can get these devices from GetRawInputDeviceList()
  3. After you've registered your devices, you will start getting WM_INPUT messages.
  4. The lParam of the WM_INPUT message contains a RAWKEYBOARD structure that you can use to determine the keyboard where the input came from, plus the virtual keycode and the type of message (WM_KEYDOWN, WM_KEYUP, ...)
  5. So you can set a flag of where the last message came from and then dispatch it to the regular keyboard input handlers.
@sancarn sancarn added the enhancement New feature or request label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant