int CSplitTestDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialogEx::OnCreate(lpCreateStruct) == -1)
return -1;
// Initialize a context for the view. CMyTreeView is my view and
// is defined as : class CMyListView : public CListView.
CCreateContext ctxList, ctxEdit;
ctxList.m_pNewViewClass = RUNTIME_CLASS(CMyListView);
ctxList.m_pCurrentDoc = NULL;
ctxList.m_pNewDocTemplate = NULL;
ctxList.m_pLastView = NULL;
ctxList.m_pCurrentFrame = NULL;
ctxEdit.m_pNewViewClass = RUNTIME_CLASS(CMyEditView);
ctxEdit.m_pCurrentDoc = NULL;
ctxEdit.m_pNewDocTemplate = NULL;
ctxEdit.m_pLastView = NULL;
ctxEdit.m_pCurrentFrame = NULL;
// Because the CFrameWnd needs a window class, we will create
// a new one. I just copied the sample from MSDN Help.
// When using it in your project, you may keep CS_VREDRAW and
// CS_HREDRAW and then throw the other three parameters.
CString strMyClass = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH)::GetStockObject(WHITE_BRUSH), ::LoadIcon(NULL, IDI_APPLICATION));
// Create the frame window with "this" as the parent
m_pFrameWnd = new CFrameWnd();
m_pFrameWnd->Create(strMyClass, _T(""), WS_CHILD, CRect(0,0,1,1), this);
m_pFrameWnd->ShowWindow(SW_SHOW);
m_pFrameWnd->MoveWindow(0, 0, 500, 400);
// and finally, create the splitter with the frame as
// the parent
m_wndSplitter.CreateStatic(m_pFrameWnd, 2, 1);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CMyListView), CSize(500,300), &ctxList);
m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CMyEditView), CSize(500,100), &ctxEdit);
return 0;
}