Partager via


CMenu::DeleteMenu

Deletes an item from the menu.

BOOL DeleteMenu( 
   UINT nPosition, 
   UINT nFlags  
);

Parameters

  • nPosition
    Specifies the menu item that is to be deleted, as determined by nFlags.

  • nFlags
    Is used to interpret nPosition in the following way:

    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.

Return Value

Nonzero if the function is successful; otherwise 0.

Remarks

If the menu item has an associated pop-up menu, DeleteMenu destroys the handle to the pop-up menu and frees the memory used by the pop-up menu.

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 CWnd::GetMenu.

Requirements

Header: afxwin.h

See Also

Reference

CMenu Class

Hierarchy Chart

CWnd::DrawMenuBar

DeleteMenu