Freigeben über


CMenu::RemoveMenu

Deletes a menu item with an associated pop-up menu from the menu.

BOOL RemoveMenu( 
   UINT nPosition, 
   UINT nFlags  
);

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.

Return Value

Nonzero if the function is successful; otherwise 0.

Remarks

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.

Requirements

Header: afxwin.h

See Also

Reference

CMenu Class

Hierarchy Chart

CWnd::DrawMenuBar

CMenu::GetSubMenu

RemoveMenu