MDI Menu
-
Hy. I'm developing an MDI application, and i've got a problem. I'm trying to add submenus to the main menu, but i can't get the MDI menu, only the main APP menu. I tried with GetMenu, but that only returns the Main App menu. How can i get a pointer to the MDI menu ???
-
Hy. I'm developing an MDI application, and i've got a problem. I'm trying to add submenus to the main menu, but i can't get the MDI menu, only the main APP menu. I tried with GetMenu, but that only returns the Main App menu. How can i get a pointer to the MDI menu ???
The menu's used in MDI are: CMainFrame::m_hMenuDefault (when no windows are open) CDocTemplate::m_hMenuShared (for each doc template added) You will need to modify these menu resources. AfxGetMainWnd()->m_hMenuDefault; for doctemplates CDocManager *pDocMan = AfxGetApp()->m_pDocManager; POSITION pos = pDocMan->GetFirstDocTemplatePosition(); while (pos) { CDocTemplate *pDocTemplate = pDocMan->GetNextDocTemplate(pos); } Thats just a quick overview. Hope its of help. Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
-
The menu's used in MDI are: CMainFrame::m_hMenuDefault (when no windows are open) CDocTemplate::m_hMenuShared (for each doc template added) You will need to modify these menu resources. AfxGetMainWnd()->m_hMenuDefault; for doctemplates CDocManager *pDocMan = AfxGetApp()->m_pDocManager; POSITION pos = pDocMan->GetFirstDocTemplatePosition(); while (pos) { CDocTemplate *pDocTemplate = pDocMan->GetNextDocTemplate(pos); } Thats just a quick overview. Hope its of help. Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
Thanx, it worked. The only problem was, that CDocTemplate doesn't contain the m_hMenuShared, the CMDIDocTemplate contains it, so here's how i made it : POSITION pos = pDocMan->GetFirstDocTemplatePosition(); while (pos) { CMultiDocTemplate *pDocTemplate = (CMultiDocTemplate*)pDocMan->GetNextDocTemplate(pos); } ::InsertMenu(pDocTemplate->m_hMenuShared,1,MF_BYPOSITION | MF_POPUP, (UINT)pMenu->m_hMenu, "submenu"); wich added the "submenu" just after "File".