Edit

Share via


WM_MENUCOMMAND message

Sent when the user invokes a command from a menu. See Remarks.

#define WM_MENUCOMMAND                  0x0126

Parameters

wParam

The zero-based index of the item selected.

lParam

A handle to the menu for the item selected.

Remarks

In most cases, you will listen for the WM_COMMAND message to respond when a user invokes a command in a menu. The WM_MENUCOMMAND message is sent instead of WM_COMMAND only for menus that are defined with the MNS_NOTIFYBYPOS flag set in the dwStyle member of the MENUINFO structure.

The WM_MENUCOMMAND message gives you a handle to the menu so you can access the menu data in the MENUINFO structure and also gives you the index of the selected item, which is typically what applications need. In contrast, the WM_COMMAND message gives you the menu item identifier.

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

Menus Overview