oblitum / Interception

The Interception API aims to build a portable programming interface that allows one to intercept and control a range of input devices.
http://oblita.com/interception
1.32k stars 271 forks source link

More documentation for "InterceptionKeyStroke". #103

Closed HubKing closed 3 years ago

HubKing commented 3 years ago

In the header, there is no comment for the InterceptionKeyStroke structure, and I cannot find any other documentation for it. How to use it? I can see an example for changing the scan code, but I cannot get it work to change a key to "volume down".

According to some web searching (really difficult to find the information), the scan code for the "volume down" key seems to be 0xE02E.

image image

But the following code gave me "c" instead. The scan code for "c" is 0x002E. So, it seems that the first byte is ignored. I thought maybe I could set some other field of the InterceptionKeyStroke, but as I said, there is no comment or documentation, so it is difficult for a novice to guess what they are for.

while (interception_receive(context, device = interception_wait(context), (InterceptionStroke*)&stroke, 1) > 0)
{
    printf("Scan code = %d", stroke.code);
    switch(stroke.code)
    {
        case 74://-
            stroke.code = 0xE02E;
            break;
    }

    interception_send(context, device, (InterceptionStroke*)&stroke, 1);
    if (stroke.code == SCANCODE_ESC) break;
}
oblitum commented 3 years ago

In the project web page there's mention of special keys, and when you need to use the other additional E0 and E1 flags. You need, scan code is not the only thing that is relevant.

oblitum commented 3 years ago

Check cadstop.cpp for example of handling special keys that have those flags set.

zhuya1996 commented 1 month ago

检查 cadstop.cpp 以获取处理设置了这些标志的特殊键的示例。

The windows key on the keyboard doesn't work, why? thanks