How can I change the menu contents dynamically, in run-time?

Override CBCG***FrameWnd::OnShowPopupMenu method:

BOOL CMainFrame::OnShowPopupMenu(CBCGPPopupMenu* pPopupMenu)
{
BOOL bRes = CBCG***FrameWnd::OnShowPopupMenu(pPopupMenu);

if (pPopupMenu != NULL)
{
// Remove item number 3 from menu
pPopupMenu->RemoveItem(3);

// Insert item with id ID_VIEW_TOOLBAR into the 2-nd position:
CBCGPToolbarMenuButton btnNewMenuItem (ID_VIEW_TOOLBAR, NULL, -1);
pPopupMenu->InsertItem(btnNewMenuItem, 2);
}

return bRes;
}
Creation date: 10/16/2016 11:29 AM     Updated: 10/16/2016 11:33 AM