After all, it’s called a hotkey, not a hotcharacter

Raymond Chen

A customer was writing a remote access program, and they were having trouble injecting hotkeys into the system.

We are sending the modified key as a scan code, and the base character as a Unicode character. We find that shortcuts of the form Modifier+Letter, such as Ctrl+A, are not working. Are there known limitations for keyboard shortcuts sent as a scancode+Unicode character?

We are sending the base character as a Unicode character to avoid issues with localization and keyboard layouts.

Keyboard shortcuts are based on virtual key codes, not Unicode characters. After all, it’s called a hotkey, not a hotcharacter.

Continuing the above example, the Ctrl+A hotkey is not a Ctrl plus the Unicode character U+0041 (LATIN CAPITAL LETTER A).

You cannot hold the Ctrl key while typing Alt+0 Alt+6 Alt+5 on the numeric keypad to get a Ctrl+A.

Even if CapsLock is off, you don’t have to hold the shift key to get a capital A.

For the hotkey Win+1, you have to press the 1 on the main keyboard, not on the numeric keypad, even if NumLock is on.

Keyboard hotkeys consist of the applicable modifiers, combined with the key on the keyboard that has the appropriate symbol printed on it. Sending a Unicode character isn’t the same as simulating a press of a key on a keyboard.

You have to send the virtual key to complete the hotkey sequence.


Discussion is closed.

Feedback usabilla icon