MapVirtualKey

  int MapVirtualKey(wCode, wMapType)    
  WORD wCode;    
  WORD wMapType;    

The MapVirtualKey function maps scan codes to virtual-key codes, and virtual-key codes to either scan codes or ANSI character values. This function is intended to be used by the Program Information File (PIF) Editor and Windows to get information about keyboard mapping.

Parameters

wCode

Specifies the input scan code or virtual-key code.

wMapType

Specifies which mapping to carry out. This parameter can be one of the following values.

Value Meaning

0 Map virtual key to scan code.
1 Map scan code to virtual key.
2 Map virtual key to ASCII characters.

Return Value

The return value (in the AX register) is a nonzero scan code or virtual-key code, if it is successful. Otherwise, the return value is zero if mapping cannot be performed.

Comments

The export ordinal for this function is 131.

For the first two mappings, the scan code to virtual-key code translation table is examined to determine the translations. Some valid codes may not be translated in this table.

For the third type of mapping, uppercase letters A through Z are returned for VK_A through VK_Z. ASCII characters are returned for the top-row numeric keys VK_0 through VK_9. For punctuation and dead keys in the main part of the keyboard, the unshifted character will be returned.

See Also

OemToAnsi, AnsiToOem