Share via


CMFCPopupMenu::InsertItem

Inserts a new item into the pop-up menu at the specified location.

int InsertItem(
   const CMFCToolBarMenuButton& button,
   int iInsertA = -1
);

Parameters

  • [in] button
    A reference to the menu item to add.

  • [in] iInsertAt
    The zero-based index for the new item. If iInsertAt is -1, the item is added to the end of the menu.

Return Value

The zero-based index of the position where the item was inserted. -1 if the method fails.

Remarks

This method will fail if you provide an invalid value for iInsertAt, such as an integer larger than the number of items currently on the pop-up menu.

Requirements

Header: afxpopupmenu.h

See Also

Reference

CMFCPopupMenu Class

Hierarchy Chart