Coding Tips (JavaScript/CSS/VBA/Win32)
Useful code snippets, tips and some Windows applications
Delete a menu dynamically in MFC
Use the following code:CWnd* pMain = AfxGetMainWnd(); // The main window _can_ be NULL, so this code // does not ASSERT and actually tests. if (pMain != NULL) { CMenu* pMenu = pMain->GetMenu(); //get a submenu 3 CMenu* pSubmenu = pMenu->GetSubMenu(2); //delete item 6 by position pSubmenu->DeleteMenu(5, MF_BYPOSITION); }