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 the 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;
}