这是SDI切分窗口,左视图为CMyTreeView,右视图为CMyListView
都是从CFormView继承来。右视图通过左视图进行大、小图标、列表、报表的变换
为什麽在弹出窗口前出现一个新建列表框对话框里面有MyTree,Mylist,My几个选项,
通过选择才可弹出窗口,随便选哪个都可弹出窗口。程序执行不受影响
这是为什麽!!!!!!!!!!!!!!!!!!!请指教!谢了!应该是小弟编的有毛病,如果想看小弟的源程序帮帮小弟改改,请各位
留下E——mail.

解决方案 »

  1.   

    你是不是在InitInstance()中将两个视图都加入了文档模板中了?AddDocTemplate();
      

  2.   

    这说明你有两个以上的DocTemplate。将一个设成默认的就可以了。
      

  3.   

    在原有的视是CFormview的基础上:
    1.作一个对话框,Sytyles:Child,Border:None,让他派生于CFormView;
    2.在XXApp.h中定义CSingleDocTemplate* m_p;
      在XXApp.cpp中
      InitInstance()
    {
    ....
    m_p = new CSingleDocTemplate(
    IDD_DIALOG,///your dialog id
    RUNTIME_CLASS(CXXDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CTTView));/////派生于CFormview AddDocTemplate(m_p);
    ...
    }3.
    CSplitterWnd m_yyz;///在CMainFrm.h中
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    // TODO: Add your specialized code here and/or call the base class
    CRect cr;
    GetClientRect(&cr);//获取窗口的大小
    CSize paneSize(100,250);//设置窗口的尺寸
    m_yyz.CreateStatic(this,1,2);//创建静态切分窗口
    m_yyz.CreateView(0,0,RUNTIME_CLASS(CTTView),paneSize,pContext);//新视
    m_yyz.CreateView(0,1,RUNTIME_CLASS(CXXView),paneSize,pContext);//原视
             return true;
    }
      

  4.   

    wujiabao(wjb) 小弟已把源码发了