CWnd::OnMenuSelect

Syntax

afx_msg void OnMenuSelect( UINT nItemID, UINT nFlags, HMENU hSysMenu );

Parameters

nItemID

Identifies the item selected. If the selected item is a menu item, nItemID contains the menu-item ID. If the selected item contains a pop-up menu, nItemID contains the pop-up menu handle.

nFlags

Contains a combination of the following menu flags:

Flag Description

MF_BITMAP Item is a bitmap.
MF_CHECKED Item is checked.
MF_DISABLED Item is disabled.
MF_GRAYED Item is dimmed.
MF_MOUSESELECT Item was selected with a mouse.
MF_OWNERDRAW Item is an owner-draw item.
MF_POPUP Item contains a pop-up menu.
MF_SEPARATOR Item is a menu-item separator.
MF_SYSMENU Item is contained in the Control menu.

hSysMenu

Identifies the menu associated with the message, if nFlags contains MF_SYSMENU.

Remarks

If the CWnd is associated with a menu, OnMenuSelect is called when the user selects a menu item.

If nFlags contains -1 and hSysMenu contains 0, Windows has closed the menu because the user pressed ESC or clicked outside the menu.

This message-handler member function calls the Default member function. Override this member function in your derived class to handle the WM_MENUSELECT message.

See Also

CWnd::Default, WM_MENUSELECT, CMenu::FromHandle