我现在有一个多文档工程,我想任意的切换主菜单,也就是任意替换主菜单。我看了MSDN上有关于单文档的做法,可是在多文档中好像行不通,
请高手指点一下,怎么才能切换多文档的主菜单呢?
拜托了

解决方案 »

  1.   

    // 注册应用程序的文档模板。文档模板
    // 将用作文档、框架窗口和视图之间的连接
    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME,  //这是菜单的资源ID,在注册不同的文档时指定主菜单,以后运行时就会被这个菜单所替换
    RUNTIME_CLASS(CStockXpDoc),
    RUNTIME_CLASS(CChildFrame), // 自定义 MDI 子框架
    RUNTIME_CLASS(CManageListView));
    AddDocTemplate(pDocTemplate);
      

  2.   

    ::SendMessage(hWndMDIClient, WM_MDISETMENU,
    (WPARAM)hMenuAlt, NULL);
      

  3.   

    First, I am not did it before.
    Second, It is maybe effective that you copy the codes about the toolbar being generated in the yourapp.cpp to your command-function.
    Three, Would you want that it likes the WINWORD of MicroSoft?
      

  4.   

    CMenu newMenu;
        newMenu.LoadMenu (IDR_YOUR);
        AfxGetApp()->GetMainWnd()->SetMenu( &newMenu );
        AfxGetApp()->GetMainWnd()->DrawMenuBar();
        newMenu.Detach ();
    &=={:::::::::::::::::::::::::::::::::::::>
      

  5.   

    ::SendMessage(hWndMDIClient, WM_MDISETMENU,
    (WPARAM)hMenuAlt, NULL);
    hWndMDIClient是mdiclient的句柄,就是mdichild的parentwnd。
    hMenuAlt是你要新设置的菜单句柄
      

  6.   

    JetCodeSun(影刀) 大侠的可以用,
    结了