Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function processes accelerator keys for menu commands. TranslateAcceleratortranslates a WM_KEYDOWNor WM_SYSKEYDOWNmessage to a WM_COMMANDmessage and then sends the WM_COMMAND message directly to the appropriate window procedure. TranslateAcceleratordoes not return until the window procedure has processed the message.
int TranslateAccelerator( HWND hWnd , HACCEL hAccTable , LPMSG lpMsg );
Parameters
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Windows CE Remarks
All accelerator key messages are translated into WM_COMMAND messages; Windows CE does not support the WM_SYSCOMMAND message.
Remarks
To differentiate the message that this function sends from messages sent by menus or controls, the high-order word of the wParamparameter of the WM_COMMAND or WM_SYSCOMMAND message contains the value 1.
Accelerator key combinations used to select items from the windowmenu are translated into WM_SYSCOMMAND messages; all other accelerator key combinations are translated into WM_COMMAND messages.
When TranslateAcceleratorreturns a nonzero value and the message is translated, the application should not use the TranslateMessagefunction to process the message again.
An accelerator need not correspond to a menu command.
If the accelerator command corresponds to a menu item, the application is sent a WM_INITMENUPOPUPmessage, as if the user were trying to display the menu. However, these messages are not sent if any of the following conditions exist:
If the specified window is the active window and no window has the keyboard focus (which is generally the case if the window is minimized), TranslateAcceleratortranslates WM_SYSKEYUPand WM_SYSKEYDOWN messages instead of WM_KEYUP and WM_KEYDOWN messages.
If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, TranslateAcceleratordoes not send a WM_COMMAND message. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the windowmenu, the function sends a WM_COMMAND message, even if the window is minimized.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h | Accel.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
CreateAcceleratorTable, GetMessage, LoadAccelerators, MSG, PeekMessage, SetCapture, TranslateMessage, WM_COMMAND, WM_INITMENUPOPUP, WM_KEYDOWN, WM_SYSKEYDOWN