v1 v2  分别为菜单项,id分别为ID_v1,ID_v2。
class Cv1 : public CView,class Cv2 : public CView,class Cv3 : public CView,class Cv4 : public CView为视图。
响应ID_v1或ID_v2,实现对窗口的分割,且分割方式不同,如响应ID_v1实现Cv1左Cv2右分割,响应ID_v2实现Cv3上Cv4下分割。我在CMainFrame中为ID_v1添加Onv1()方法
void CMainFrame::Onv1() 
{
CCreateContext Context;
Context.m_pNewViewClass=RUNTIME_CLASS(Cv1);
Context.m_pCurrentDoc=((CExApp*)AfxGetApp())->m_pDoc;
Context.m_pNewDocTemplate=Context.m_pCurrentDoc->GetDocTemplate();
Context.m_pCurrentFrame=this;
Context.m_pLastView=(CView*)m_wndSplitter.GetPane(0,0);

m_wndSplitter.CreateStatic(this,1, 2);
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(Cv1),CSize(110,200),&Context);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(Cv2),CSize(1,1),&Context);
}
不知道那错了 在运行时出错。请各位大侠帮我看看,谢谢先。

解决方案 »

  1.   

    弹出一个microsoft visual c++ debug library 对话框
    内容为 
    Proram: D\vc6.0\ex\debug\ex.exe
    file:afxwin2.inl
    line:958
    for information on how your program can cause an assertion failure see the visual c++ documentation on asserts
      

  2.   

    你的文档对象指针空了
    Context.m_pCurrentDoc=((CExApp*)AfxGetApp())->m_pDoc;
    导致下一句 调用获取文档模板GetDocTemplate()出错 
    Context.m_pNewDocTemplate=Context.m_pCurrentDoc->GetDocTemplate();在调用 CMainFrame::Onv1() 之前你把视图对象删完了?(会导致文档对象自动删除)还有在你调用CMainFrame::Onv1() 之前m_wndSplitter对象调用过CreateStatic没?
    提供信息不够