-
2008-07-25
在创建View时,将该View怎样加入Document的视图链表的。 - [Codejock]
int CView::OnCreate(LPCREATESTRUCT lpcs)
{
if (CWnd::OnCreate(lpcs) == -1)
return -1;
// if ok, wire in the current document
ASSERT(m_pDocument == NULL);
CCreateContext* pContext = (CCreateContext*)lpcs->lpCreateParams;
// A view should be created in a given context!
if (pContext != NULL && pContext->m_pCurrentDoc != NULL)
{
pContext->m_pCurrentDoc->AddView(this);
ASSERT(m_pDocument != NULL);
}
else
{
TRACE(traceAppMsg, 0, "Warning: Creating a pane with no CDocument.\n");
}
return 0; // ok
}
共1页 1







