我创建的是一个多文档的工程 对主框架进行切分可以显示四个视图
我在第一个视图里通过按钮菜单消息在主框架类中切换第三个片视图
我想在切换的时候关联到文档 但是运行到创建新视图的时候会出错 如果不关联文档的话就不会出错
请大家帮我看看哦!!!!!!!!!!!!!
我的代码如下:
void CMainFrame::SwitchToEQUView()
{
CCreateContext pContext;
CMultiDocTemplate *pDocTemplate = theApp.pEquDocTemplate;
pContext.m_pNewViewClass = RUNTIME_CLASS(CEQuView);
pContext.m_pNewDocTemplate = pDocTemplate;
pContext.m_pCurrentDoc = (CDocument*)AfxGetApp()->m_pDocManager; m_wndSplitter.DeleteView(2,0);
m_wndSplitter.CreateView(2,0,RUNTIME_CLASS(CEQuView),CSize(300,300),&pContext);//出错
m_wndSplitter.RecalcLayout();
InvalidateRect(NULL);
}
当运行到m_wndSplitter.CreateView(2,0,RUNTIME_CLASS(CEQuView),CSize(300,300),&pContext);
的时候就会出错.请问这个要怎么样弄啊????????
我在第一个视图里通过按钮菜单消息在主框架类中切换第三个片视图
我想在切换的时候关联到文档 但是运行到创建新视图的时候会出错 如果不关联文档的话就不会出错
请大家帮我看看哦!!!!!!!!!!!!!
我的代码如下:
void CMainFrame::SwitchToEQUView()
{
CCreateContext pContext;
CMultiDocTemplate *pDocTemplate = theApp.pEquDocTemplate;
pContext.m_pNewViewClass = RUNTIME_CLASS(CEQuView);
pContext.m_pNewDocTemplate = pDocTemplate;
pContext.m_pCurrentDoc = (CDocument*)AfxGetApp()->m_pDocManager; m_wndSplitter.DeleteView(2,0);
m_wndSplitter.CreateView(2,0,RUNTIME_CLASS(CEQuView),CSize(300,300),&pContext);//出错
m_wndSplitter.RecalcLayout();
InvalidateRect(NULL);
}
当运行到m_wndSplitter.CreateView(2,0,RUNTIME_CLASS(CEQuView),CSize(300,300),&pContext);
的时候就会出错.请问这个要怎么样弄啊????????
谢谢!!!
是否还有其它的解决方法,或者文档摸扳有多个的时候怎么弄
我的工程是有多个视图同时用一个Document.有多个CMultiDocTemplate
现在只在做界面 以后还做数据处理 怕会有新的问题.
如果没人回答那我这两天也结贴了,把虽不多的分给whoo了.