GetKeyNameText

Version 3.0

Syntax

int GetKeyNameText(lParam,lpBuffer,nSize)

This function retrieves a string which contains the name of a key.

The keyboard driver maintains a list of names in the form of character strings for keys with names longer than a single character. The key name is translated according to the layout of the currently installed keyboard. The translation is performed for the principal language supported by the keyboard driver.

Parameter Type/Description  
lParam DWORD Specifies the 32-bit parameter of the keyboard message (such as WM_KEYDOWN) which the function is processing. Byte 3 (bits 16–23) of the long parameter is a scan code. Bit 20 is the extended bit that distinguishes some keys on an enhanced keyboard. Bit 21 is a “don't care” bit; the application calling this function sets this bit to indicate that the function should not distinguish between left and right control and shift keys, for example.  
lpBuffer LPSTR Specifies a buffer to receive the key name.  
nSize WORD Specifies the maximum length in bytes of the key name, not including the terminating NULL character.  

Return Value

The return value is the actual length of the string copied to lpBuffer.