VkKeyScan

Syntax

int VkKeyScan (cChar)

This function translates an ANSI character to the corresponding virtual-key code and shift state for the current keyboard. Applications which send character by means of WM_KEYUP and WM_KEYDOWN messages use this function.

Parameter Type/Description  

cChar char Specifies the character for which the corresponding virtual-key code is to be found.  

Return Value

The VK_ code is returned in the low-order byte and the shift state in the high-order byte. The shift states are:

Value Meaning  

0 No shift.  
1 Character is shifted.  
2 Character is control character.  
6 Charcter is CONTROL+ALT.  
7 Character is SHIFT+CONTROL+ALT.  
3, 4, 5 A shift key combination that is not used for characters.  

If no key is found that translates to the passed ANSI code, a –1 is returned in both the low-order and high-order bytes.

Comments

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.