Partager via


Keyboard Messages

The following table shows the keyboard messages, with a description of the purpose of each.

Programming element Description
WM_ACTIVATE This message is sent when a window is being activated or deactivated.
WM_CHAR This message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function.
WM_HOTKEY This message is posted when the user presses a hot key registered by the RegisterHotKey function.
WM_INITMENUPOPUP This message is sent when a pop-up menu is about to become active.
WM_KEYDOWN This message is posted to the window with the keyboard focus when a nonsystem key is pressed.
WM_KEYUP This message is posted to the window with the keyboard focus when a nonsystem key is released.
WM_KILLFOCUS This message is sent to a window immediately before it loses the keyboard focus.
WM_MENUCHAR This message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key.
WM_SETFOCUS This message is sent to a window after it has gained the keyboard focus.
WM_SYSCHAR This message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function.
WM_SYSCOMMAND This message is sent to a window when the user chooses a command from the window menu, formerly known as the system or control menu, or when the user chooses the maximize button or the minimize button.
WM_SYSDEADCHAR This message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function.
WM_SYSKEYDOWN This message is posted to the window with the keyboard focus when the user holds down the ALT key and then presses another key.
WM_SYSKEYUP This message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down.

See Also

Keyboard Reference

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.