WM_MENUCOMMAND message

Sent when the user makes a selection from a menu.

#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

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.

The WM_MENUCOMMAND message is sent only for menus that are defined with the MNS_NOTIFYBYPOS flag set in the dwStyle member of the MENUINFO structure.

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