WM_MENUSELECT

WM_MENUSELECT

uItem = (UINT) LOWORD(wParam); /* item identifier */

fuFlags = (UINT) HIWORD(wParam); /* menu-item flags */

hmenu = (HMENU) lParam; /* pop-up menu handle */

The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.

Parameters

uItem

Value of the low-order word of wParam. If the selected item is a command item, this parameter contains the identifier of the menu-item. If the selected item invokes a pop-up menu, this parameter is undefined, but the hmenu parameter specifies the handle of the pop-up menu.

fuFlags

Value of the high-order word of wParam. Specifies one or more menu flags. This parameter can be a combination of the following values:

Flag Description

MF_BITMAP Item displays a bitmap.
MF_CHECKED Item is checked.
MF_DISABLED Item is disabled.
MF_GRAYED Item is grayed.
MF_MOUSESELECT Item was selected with the mouse.
MF_OWNERDRAW Item is an owner-draw item.
MF_POPUP Item invokes a pop-up menu.
MF_SYSMENU Item is contained in the System menu. The hmenu parameter identifies the System menu associated with the message.

hmenu

Value of lParam. Identifies the pop-up menu invoked by the selected menu item.

Return Value

An application should return zero if it processes this message.

Comments

If the low-order word of the lParam parameter contains -1 and the high-order word of the lParam parameter contains 0, Windows has closed the menu because the user pressed ESC or clicked outside the menu.