步骤:
1、正常建立MFC SDI工程
2、在CMainFrame::PreCreateWindow中屏蔽菜单栏
Steps to Create SDI Application that Has No Menu Bar
- Generate an SDI application with AppWizard. Do not delete the IDR_MAINFRAME menu resource. If you have an application that was not generated with AppWizard, do not delete the corresponding main menu resource. Leaving the menu resource is required to avoid
assertion failures in the MFC code.
- To prevent the main application window from having a menu bar, delete the already loaded menu, and set the hMenu field of the CREATESTRUCT structure to NULL in the CFrameWnd::PreCreateWindow() function:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if(cs.hMenu!=NULL) { ::DestroyMenu(cs.hMenu); // delete menu if loaded cs.hMenu = NULL; // no menu for this window } return CFrameWnd::PreCreateWindow(cs); }