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

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


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.


Creates an accelerator table.


Destroys an accelerator table.


Loads the specified accelerator table.


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


Sent to indicate that the UI state should be changed.


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.


Sent to retrieve the UI state for a window.


Sent to change the UI state for the specified window and all its child windows.


Keyboard Accelerator Notifications


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.


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.


Sent to a menu's owner window when the user selects a menu item.


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.


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


Defines an accelerator key used in an accelerator table.