WM_MENUSELECT

2.x

WM_MENUSELECT
wIDItem = wParam;               /* item identifier or menu handle */
fwMenu = LOWORD(lParam);        /* menu flags                     */
hmenu = (HMENU) HIWORD(lParam); /* handle of the menu             */

The WM_MENUSELECT message is sent to the window associated with a menu when the user selects a menu item.

Parameters

wIDItem

Value of wParam. Specifies the menu-item identifier if the selected item is a menu item. If the selected item contains a pop-up menu, wIDItem contains the handle of the pop-up menu.

fwMenu

Low word of lParam. Specifies one or more menu flags. This parameter can be a combination of the following values:

Flag Description

MF_BITMAP Item is a bitmap.
MF_CHECKED Item is checked.
MF_DISABLED Item is disabled.
MF_GRAYED Item is grayed.
MF_MOUSESELECT Item was selected with a mouse.
MF_OWNERDRAW Item is an owner-drawn item.
MF_POPUP Item contains a pop-up menu.
MF_SEPARATOR Item is a menu-item separator.
MF_SYSMENU Item is contained in the System menu (sometimes referred to as the Control menu). The hmenu parameter identifies the System menu associated with the message.

hmenu

High word of lParam. If the fwMenu parameter contains the MF_SYSMENU flag, this parameter specifies the menu handle of the System menu.

Return Value

An application should return zero if it processes this message.

Comments

If the fwMenu parameter contains –1 and the hmenu parameter contains 0, Windows has closed the menu. This occurs both when the menu is closed because the user pressed ESC or clicked outside the menu and when the user has selected a menu item.