Keyboard Accelerators

A keyboard accelerator (or, simply, accelerator) is a keystroke or combination of keystrokes that generates a WM_COMMAND or WM_SYSCOMMAND message for an application.

In This Section

Name Description
About Keyboard Accelerators Discusses keyboard accelerators.
Using Keyboard Accelerators Discusses tasks that are associated with keyboard accelerators.
Keyboard Accelerator Reference Contains the API reference.

Keyboard Accelerator Functions

Name Description
CopyAcceleratorTable Copies the specified accelerator table. This function is used to obtain the accelerator-table data that corresponds to an accelerator-table handle, or to determine the size of the accelerator-table data.
CreateAcceleratorTable Creates an accelerator table.
DestroyAcceleratorTable Destroys an accelerator table.
LoadAccelerators Loads the specified accelerator table.
TranslateAccelerator Processes accelerator keys for menu commands. The function translates a WM_KEYDOWN or WM_SYSKEYDOWN message to a WM_COMMAND or WM_SYSCOMMAND message (if there is an entry for the key in the specified accelerator table) and then sends the WM_COMMAND or WM_SYSCOMMAND message directly to the specified window procedure. TranslateAccelerator does not return until the window procedure has processed the message.

Keyboard Accelerator Messages

Name Description
WM_CHANGEUISTATE Sent to indicate that the UI state should be changed.
WM_INITMENU Sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed.
A window receives this message through its WindowProc function.
WM_QUERYUISTATE Sent to retrieve the UI state for a window.
WM_UPDATEUISTATE Sent to change the UI state for the specified window and all its child windows.

Keyboard Accelerator Notifications

Name Description
WM_INITMENUPOPUP Sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu.
WM_MENUCHAR Sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu.
WM_MENUSELECT Sent to a menu's owner window when the user selects a menu item.
WM_SYSCHAR Posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key that is, a character key that is pressed while the ALT key is down.
WM_SYSCOMMAND A window receives this message when the user chooses a command from the Window menu or when the user chooses the maximize button, minimize button, restore button, or close button.

Keyboard Accelerator Structures

Name Description
ACCEL Defines an accelerator key used in an accelerator table.