0

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.

Tim
  • 2,731
  • 9
  • 35
  • 72
  • 1
    I think what you are referring to are [modifier keys](http://en.wikipedia.org/wiki/Modifier_key)? [Hot keys](http://msdn.microsoft.com/en-us/library/windows/desktop/bb775233(v=vs.85).aspx) are a very different thing. You should rephrase your question to clarify. – gregmac Nov 07 '12 at 23:33
  • @gregmac - Thank you for the suggestion. I am setting up global hotkeys, but you are correct, I am asking about the modifier codes. I've made changes to my question to try to be more specific. – Tim Nov 08 '12 at 15:30

2 Answers2

0

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.

Zack
  • 2,789
  • 33
  • 60
  • Thank you for the reply. My understanding is that the Modifiers are different from Keys when setting up Global Hotkeys. They appear to use a bitwise numbering so they can be combined, hence the 1, 2, 4, 8 numbering scheme. Thank you again for your response. – Tim Nov 08 '12 at 16:05
0

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.

Tim
  • 2,731
  • 9
  • 35
  • 72