CMenu::RemoveMenu

Syntax

BOOL RemoveMenu( UINT nPosition, UINT nFlags );

Parameters

nPosition

Specifies the menu item to be removed. The interpretation of nPosition depends on the setting of nFlags as shown in the following list:

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, allowing the menu to be reused. Before calling this function, the application may call GetSubMenu 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.

Return Value

TRUE if the function is successful; otherwise FALSE.

See Also

CWnd::DrawMenuBar, CMenu::GetSubMenu, ::RemoveMenu