template <class character>
int get_key_name_text(parameter parameter2,
                     character* string,
                     int size)

This function obtains a string containing the name of a key.


parameter parameter2

The second parameter of the keyboard message (for example message::key_down) to be processed. The following portions of parameter2 are interpreted.

Bits Meaning
16-23 Scan code.
24 Extended-key flag (for keys on an enhanced keyboard).
25 left and right ctrl and shift keys are indistinguishable.

character* string

A pointer to a buffer to hold the key name.

int size

The size (in characters) of the key name buffer provided by the previous parameter. The value specified should include room for a null-terminator.



Zero The function failed.
Other The length of the string (in characters) of the string copied to the buffer (not including the null-terminator).


The format of the key-name string depends upon the current keyboard layout. For keys whose names exceed a single character, the keyboard driver maintains a list of names (in the form of character strings). The key name is translated according to the currently installed keyboard layout. The name of a single character key is the character itself. The names of accent keys are spelled out in full.