Share via


CMenu::RemoveMenu

BOOLRemoveMenu(UINTnPosition**,UINTnFlags);**

Return Value

Nonzero if the function is successful; otherwise 0.

Parameters

nPosition

Specifies the menu item to be removed. The nFlags parameter can be used to interpret nPosition in the following ways:

nFlags Interpretation of nPosition
MF_BYCOMMAND Specifies that the parameter gives the command ID of the existing menu item. This is the default if neither MF_BYCOMMAND nor MF_BYPOSITION is set.
MF_BYPOSITION Specifies that the parameter gives the position of the existing menu item. The first item is at position 0.

nFlags

Specifies how nPosition is interpreted.

Remarks

Deletes a menu item with an associated pop-up menu from the menu. It does not destroy the handle for a pop-up menu, so the menu can be reused. Before calling this function, the application may call the GetSubMenu member function to retrieve the pop-up CMenu object for reuse.

Whenever a menu that resides in a window is changed (whether or not the window is displayed), the application must call CWnd::DrawMenuBar.

Example

See the example for CMenu::InsertMenu.

CMenu OverviewClass MembersHierarchy Chart

See Also   CWnd::DrawMenuBar, CMenu::GetSubMenu,