Key Status

While processing a keyboard message, an application may need to determine the status of another key besides the one that generated the current message. For example, a word-processing application that allows the user to press shift+end to select a block of text must check the status of the shift key whenever it receives a keystroke message from the end key. The application can use the GetKeyState function to determine the status of a virtual key at the time the current message was generated; it can use the GetAsyncKeyState function to retrieve the current status of a virtual key.

The keyboard layout maintains a list of names. The name of a key that produces a single character is the same as the character produced by the key. The name of a noncharacter key such as tab and enter is stored as a character string. An application can retrieve the name of any key from the device driver by calling the GetKeyNameText function.