WM_MENUSELECT message

Sent to a menu's owner window when the user selects a menu item.

#define WM_MENUSELECT                   0x011F

Parameters

wParam

The low-order word specifies the menu item or submenu index. If the selected item is a command item, this parameter contains the identifier of the menu item. If the selected item opens a drop-down menu or submenu, this parameter contains the index of the drop-down menu or submenu in the main menu, and the lParam parameter contains the handle to the main (clicked) menu; use the GetSubMenu function to get the menu handle to the drop-down menu or submenu.

The high-order word specifies one or more menu flags. This parameter can be one or more of the following values.

Value Meaning
MF_BITMAP
0x00000004L
Item displays a bitmap.
MF_CHECKED
0x00000008L
Item is checked.
MF_DISABLED
0x00000002L
Item is disabled.
MF_GRAYED
0x00000001L
Item is grayed.
MF_HILITE
0x00000080L
Item is highlighted.
MF_MOUSESELECT
0x00008000L
Item is selected with the mouse.
MF_OWNERDRAW
0x00000100L
Item is an owner-drawn item.
MF_POPUP
0x00000010L
Item opens a drop-down menu or submenu.
MF_SYSMENU
0x00002000L
Item is contained in the window menu. The lParam parameter contains a handle to the menu associated with the message.

lParam

A handle to the menu that was clicked.

Return value

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

Remarks

If the high-order word of wParam contains 0xFFFF and the lParam parameter contains NULL, the system has closed the menu.

Do not use the value 1 for the high-order word of wParam, because this value is specified as (UINT) HIWORD(wParam). If the value is 0xFFFF, it would be interpreted as 0x0000FFFF, not 1, because of the cast to a UINT.

Requirements

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

Reference

GetSubMenu

HIWORD

LOWORD

Conceptual

Keyboard Accelerators