Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Resources
Menus
Menu Reference
Notifications
 WM_COMMAND Notification
WM_COMMAND Notification

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

Syntax

WM_COMMAND

    WPARAM wParam
    LPARAM lParam;

Return Value

If an application processes this message, it should return zero.

Remarks

Use of the wParam and lParam parameters are summarized here.

Message SourcewParam (high word)wParam (low word)lParam
Menu0Menu identifier (IDM_*)0
Accelerator1Accelerator identifier (IDM_*)0
ControlControl-defined notification codeControl identifierHandle to the control window

Menus

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.

Windows 98/Me, Windows 2000/XP: If a menu is defined with a MENUINFO.dwStyle value of MNS_NOTIFYBYPOS, WM_MENUCOMMAND is sent instead of WM_COMMAND.

Accelerators

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_COMMAND message 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.

Notification Requirements

Minimum DLL Version None
HeaderDeclared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1

See Also

Menus Overview, HIWORD, LOWORD
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Value      Dzonny   |   Edit   |  
WM_COMMAND = &H111
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker