MapVirtualKeyEx


int MapVirtualKeyEx(WORD wCode, WORD wMapType, DWORD lcid);

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

wCode

Input scan code or virtual-key code.

wMapType

Mapping to carry out. Can be one of these values.

Value

Meaning

0

Map virtual key to scan code.

1

Map scan code to virtual key.

2

Map virtual key to ASCII character.


lcid

Layout identifier. This must be a valid identifier as passed to the driver via the NewtableEx function.

The export ordinal for this function is 12.

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 NewTableEx