在sdi 我要做要一个菜单动作把原来切分窗口中两个视图都换掉
要把原来的视图保存起来
void CMainFrame::OnConsoleOpr() 
{
// TODO: Add your command handler code here
pDoc=(CRoverDoc*)GetActiveDocument();
if(pDoc->islogin)
{
if(pDoc->curView!=2)
{
pDoc->curView=2;
CCreateContext Context;
Context.m_pNewViewClass=RUNTIME_CLASS(COperTreeView);
Context.m_pCurrentDoc=this->GetActiveDocument();
Context.m_pCurrentFrame=this;
Context.m_pNewDocTemplate=Context.m_pCurrentDoc->GetDocTemplate();
Context.m_pLastView=(CView*)m_wndSplitter.GetPane(0,0);
CView *pLastView;
pLastView=(CView*)m_wndSplitter.GetPane(0,0);
m_wndSplitter.DeleteView(0, 0);

m_wndSplitter.CreateView(0, 0,RUNTIME_CLASS(COperTreeView),CSize(100,0), &Context);
COperTreeView *pTreeView=(COperTreeView*)m_wndSplitter.GetPane(0,0);
// SetWindowLong(pLastView->m_hWnd, GWL_ID, 0);
SetWindowLong(pTreeView->m_hWnd, GWL_ID, m_wndSplitter.IdFromRowCol(0, 0));
pTreeView->GetParentFrame()->RecalcLayout();
// pTreeView->OnInitialUpdate(); 
m_wndSplitter.RecalcLayout();
m_wndSplitter.DeleteView(0, 1);
Context.m_pNewViewClass=RUNTIME_CLASS(COperView);
Context.m_pCurrentDoc=this->GetActiveDocument();
Context.m_pCurrentFrame=this;
Context.m_pNewDocTemplate=Context.m_pCurrentDoc->GetDocTemplate();
Context.m_pLastView=(CView*)m_wndSplitter.GetPane(0,1);
pLastView=(CView*)m_wndSplitter.GetPane(0,1);

m_wndSplitter.CreateView(0, 1,RUNTIME_CLASS(COperView),CSize(0,0), &Context);
COperView *pView=(COperView*)m_wndSplitter.GetPane(0,1);
// SetWindowLong(pLastView->m_hWnd, GWL_ID, 0);
SetWindowLong(pView->m_hWnd, GWL_ID, m_wndSplitter.IdFromRowCol(0, 1)); pView->GetParentFrame()->RecalcLayout();

m_wndSplitter.RecalcLayout();



// pView->OnInitialUpdate(); 
m_wndSplitter.SetActivePane(0,1);

}

pDoc->UpdateAllViews(NULL);
}
else
{
pDoc->Login();
}
AfxMessageBox(_T("CMainFrame::OnConsoleOpr"));
}
这是我的一段代码 
主要是视图可以切换过去 但是就是视图的窗口无法响应我写的一些事件函数
大侠们帮帮忙 分不够可以再加