// View.cpp
int CXXXView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
if(NULL == m_wndSplitter.GetSafeHwnd())
{
CCreateContext cc;
memset(&cc, 0, sizeof(CCreateContext));
CRect rc;
GetWindowRect(&rc);
VERIFY(m_wndSplitter.CreateStatic(this, 1, 2, WS_CHILD | WS_VISIBLE));
cc.m_pNewViewClass = RUNTIME_CLASS(CLeftView);
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(300, rc.Height()), &cc));
cc.m_pNewViewClass = RUNTIME_CLASS(CRightView);
VERIFY(m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CRightView), CSize(0, rc.Height()), &cc));
m_wndSplitter.MoveWindow(0, 0, rc.Width(), rc.Height());
m_bSplitter = TRUE;
}
return 0;
}
void CXXXView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(m_bSplitter && m_wndSplitter.GetSafeHwnd())
{
m_wndSplitter.MoveWindow(0, 0, cx, cy);
}
}