Pergunta

I am hooking a USB remote up to my software, and need to register global hotkeys to work with it. I have the code in place, and it is working as expected, but when I hook the remote up, I found that it requires a specific Left or Right Alt when dealing with the modifier keys.

In other words, right now I have the global hotkey set up to accept ALT + SHIFT + 0 to run a specific function. When I hooked the remote up, I realized that their mapping requires the specific Key modifier to be identified. Thus, I need to search specifically for L-ALT + L-SHIFT + 0. I have searched for these modifier mappings, but have not been able to find anything that says what they are. I have only been able to find the modifiers for the general ALT key rather than the specific L-ALT modifier.

Currently, I have my keys defined as such:

    public const int NOMOD = 0x0000;            //  No HotKey
    public const int ALT = 0x0001;              //  ALT
    public const int CTRL = 0x0002;             //  CTRL
    public const int SHIFT = 0x0004;            //  SHIFT
    public const int WIN = 0x0008;              //  WIN button
    public const int WM_HOTKEY_MSG_ID = 0x0312; //  Windows message ID for HotKey

I have tried to find a mapping for what the code would be for L-Alt, L-CTRL, and L-Shift, but have been unsuccessful. They don't seem to be ASCII. Does anyone know the correct codes for these, or where I can find them? Thanks.

Foi útil?

Solução

I typed Keys and hit F12 to go to the definition and it has left alt and right alt listed as LMenu and RMenu with the values of 164 and 165. Does this help you or am I totally looking in the wrong place.

Outras dicas

Additional research shows that you cannot map a global hotkey using specific SHIFT, ALT, and CTRL keys. However, after much experimentation and re-reading the remote's documentation, I found that they were not using the standard ASCII key mapping for their keys. They were marking the upper left key as 0, and counting across and then down to the bottom right key. Thus, 0 was mapped to ESC, and in my case, 18 was mapped to the 1 key.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top