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.
Overviews
About Keyboard Accelerators
This topic discusses keyboard accelerators.
Using Keyboard Accelerators
This section covers tasks that are associated with keyboard accelerators.
Functions
CopyAcceleratorTable
The CopyAcceleratorTable function 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
The CreateAcceleratorTable function creates an accelerator table.
DestroyAcceleratorTable
The DestroyAcceleratorTable function destroys an accelerator table. Before an application closes, it must use this function to destroy each accelerator table that it created by using the CreateAcceleratorTable function.
LoadAccelerators
The LoadAccelerators function loads the specified accelerator table.
TranslateAccelerator
The TranslateAccelerator function 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.
Messages
WM_CHANGEUISTATE
An application sends the WM_CHANGEUISTATE message to indicate that the user interface (UI) state should be changed.
WM_INITMENU
The WM_INITMENU message is 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
An application sends the WM_QUERYUISTATE message to retrieve the UI state for a window.
WM_UPDATEUISTATE
An application sends the WM_UPDATEUISTATE message to change the UI state for the specified window and all its child windows.
Notifications
WM_INITMENUPOPUP
The WM_INITMENUPOPUP message is 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
The WM_MENUCHAR message is 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
The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.
WM_SYSCHAR
The WM_SYSCHAR message is 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
WM_SYSCOMMAND
A window receives this message 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, minimize button, restore button, or close button.
Structures
ACCEL
The ACCEL structure defines an accelerator key used in an accelerator table.