Is it possible to learn a key in Raw Input?

I use the Raw Input API because I need to be able to respond to keys from another USB HID device differently, even if it is the same key.

The correct messages are in my window WM_INPUT. I can get the structure RAWKEYBOARDto get all the necessary information.

Now I want these USB devices to not be able to switch from NumLock. I hope that the Raw Input API can let me learn NumLock clicks?

Ive tried setting the WM_INPUT messages to Result 1, but that doesn't seem to have an effect.

(I write this in C #, but since this is all a low-level Windows API, you probably don't need to know C # or .NET to answer this question.)

EDIT: Oh yes, I also tried using the global keyboard hook ( SetWindowsHookEx) to learn pressing NumLock. Unfortunately, as soon as I initialize the Raw Input API, the global keyboard hook is no longer called while the window is active. Ive also tried to set a global hook after Raw Input, but the same effect.

+5
source share
3 answers

The Raw Input API does not support swallowing keystrokes.

In addition, it does not interact with SetWindowsHookExwithin the same process. As soon as the initial input API is initialized, the hook is detached.

, . SetWindowsHookEx , API- Raw Input . . .

+3

, , , .

-, ENTER.

, RawInput -. 0-9 ENTER . , :

SendKeys.SendWait("{ENTER}");

0

You can “learn” some keystrokes only by writing a kernel keyboard filter driver. So, if you are still at it, you will need DDK.

-2
source

All Articles