SHORT VkKeyScan(cChar) | |||||
TCHAR cChar; | /* specifies the character to translate | */ |
The VkKeyScan function translates a character to the corresponding virtual-key code and shift state for the current keyboard.
cChar
Specifies the character to be translated into a virtual-key code.
The low-order byte of the return value contains the virtual-key code, if the function is successful; the high-order byte contains the shift state, which can be one of the following:
Value | Meaning |
1 | Character is shifted. |
2 | Character is a control character. |
3–5 | A shift key combination that is not used for characters. |
6 | Character is generated by the CTRL+ALT key combination. |
7 | Character is generated by the SHIFT+CTRL+ALT key combination. |
If no key is found that translates to the passed character code, both the low-order and high-order bytes contain -1.
The VkKeyScan function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set).
Translations for the numeric keypad (VK_NUMPAD0 through VK_DIVIDE) are ignored. This function is intended to force a translation for the main keyboard only.
Applications that send characters by using the WM_KEYUP and WM_KEYDOWN messages use this function.
GetAsyncKeyState, GetKeyNameText, GetKeyState, GetKeyboardState, SetKeyboardState