0

Is there a way to have one raw input buffer per device?

So I would like to have a buffer for mouse and another one for keyboard. Is it possible?

2 Answers 2

1

Yes, try SetWindowsHookEx. You will have to convert WM_KEY* messages to WM_CHAR yourself, though.

Sign up to request clarification or add additional context in comments.

1 Comment

You will have to buffer them yourself. Is the buffering provided by Windows enough ? It will "buffer" the messages sent to your WNDPROC, and you can split them with a filter. But it is not very separate and it is hardly raw.
1

The answer to your question is YES

The RAWINPUTDEVICE struct permits this via usUsagePage and usUsage

usUsagePage is a value for the type of device (this is a partial list below). 1 is for 'generic desktop controls' and covers all the usual input devices. The usUsage value specifies the device within the 'generic desktop controls' group.

1 - generic desktop controls // we use this
2 - simulation controls
3 - vr
4 - sport
5 - game
6 - generic device
7 - keyboard
8 - LEDs
9 - button

usUsage values when usUsagePage is 1:

0 - undefined
1 - pointer
2 - mouse
3 - reserved
4 - joystick
5 - game pad
6 - keyboard // we use this
7 - keypad
8 - multi-axis controller
9 - Tablet PC controls

I wrote this article on Code Project that may be helpful.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.