BCGControlBar Pro for MFC
void CBCGPToolbarCustomize::AddMenuCommands ( const CMenu *  pMenu,
BOOL  bPopup,
LPCTSTR  lpszCategory = NULL,
LPCTSTR  lpszMenuPath = NULL 
)

Adds a menu commands to the list box of commands on the "Commands" page.

The AddMenuCommands function loops over all menu items of pMenu. For each menu item it checks whether the item has a valid command ID (a regular item), 0 (a separator), or it is a popup menu item. Then, it converts the regular items to the CBCGPToolbarButton objects, and calls the AddButton() member function to add the menu item as a toolbar button to the list box of commands on the "Commands" page.

If bPopup is TRUE it converts the popup menu items to the CBCGPToolbarMenuButton objects and inserts them to the list of commands, otherwise the popup menu items are not displayed in the list of commands.

When this function encounters a popup menu item, it calls itself recursively passing a pointer to the sub menu as the pMenu parameter.

Parameters
pMenuSpecifies a pointer to the CMenu object to add.
bPopupSpecifies whether to insert the popup menu items to the list of commands.
lpszCategorySpecifies the name of the category to insert the menu.
lpszMenuPathSpecifies the name of the category to insert the menu.