Share via


WM_COMMAND

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This message is sent when the user selects a command item from a menu, when a control sends a message to its parent window, or when an accelerator keystroke is translated.

Syntax

WM_COMMAND wNotifyCode = HIWORD(wParam); 
    wID = LOWORD(wParam); 
    hwndCtl = (HWND) lParam;

Parameters

  • wNotifyCode
    Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.
  • wID
    Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator.
  • hwndCtl
    Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.

Return Value

An application should return zero if it processes this message.

Remarks

Accelerator keystrokes that select items from the window menu are translated into WM_SYSCOMMAND messages.

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, no WM_COMMANDmessage is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized.

If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

WM_SYSCOMMAND
Menus Messages