共用方式為


CMFCToolBarsCustomizeDialog::AddMenuCommands

Adds items to the list of commands in the Commands page to represent all the items in the specified menu.

void AddMenuCommands(
   const CMenu* pMenu,
   BOOL bPopup,
   LPCTSTR lpszCategory=NULL,
   LPCTSTR lpszMenuPath=NULL 
);

Parameters

  • [in] pMenu
    A pointer to the CMenu object to add.

  • [in] bPopup
    Specifies whether to insert the popup menu items to the list of commands.

  • [in] lpszCategory
    The name of the category to insert the menu.

  • [in] lpszMenuPath
    A prefix that is added to the name when the command is shown in the All Categories list.

Remarks

The AddMenuCommands method loops over all menu items of pMenu. For each menu item that does not contain a submenu, this method creates a CMFCToolBarButton Class object and calls the CMFCToolBarsCustomizeDialog::AddButton method to add the menu item as a toolbar button to the list of commands on the Commands page. Separators are ignored in this process.

If bPopup is TRUE, for each menu item that contains a submenu this method creates a CMFCToolBarMenuButton Class object and inserts it into the list of commands by calling AddButton. Otherwise menu items that contain submenus are not displayed in the list of commands. In either case, when AddMenuCommands encounters a menu item with a submenu it calls itself recursively, passing a pointer to the submenu as the pMenu parameter and appending the label of the submenu to lpszMenuPath.

Requirements

Header: afxToolBarsCustomizeDialog.h

See Also

Reference

CMFCToolBarsCustomizeDialog Class

Hierarchy Chart