Create your class derived from CSplitterWnd. add a funtion ChangeView to it. Use this class to split and change your view.
ChangeView(int row, int col, CRuntimeClass* pViewClass)
{
ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView)));
CView* pView = STATIC_DOWNCAST(CView, GetPane(row, col));
CFrameWnd* pFrame = pView->GetParentFrame();
ASSERT(pFrame);
// set up create context to preserve doc/frame etc.
CCreateContext cc;
memset(&cc, sizeof(cc), 0);
cc.m_pNewViewClass = pViewClass;
cc.m_pCurrentDoc = pView->GetDocument();
cc.m_pNewDocTemplate = cc.m_pCurrentDoc ?
cc.m_pCurrentDoc->GetDocTemplate() : NULL;
cc.m_pCurrentFrame = pFrame;
DeleteView(row, col); // delete old view
VERIFY(CreateView(row, col, // create new one
pViewClass,
CSize(0,0), // will fix in RecalcLayout
&cc));
RecalcLayout(); // recompute layout
// initialize the view
CWnd* pWnd = GetPane(row, col);
if (pWnd)
pWnd->SendMessage(WM_INITIALUPDATE);
}
Regards Anil