Multiple views for a single document (MDI) 2
Posted
by Chris Kirby
on August 6th, 1998
Assuming the following are already declared in the app:
CMultiDocTemplate * m_pTemplate; CWhateverDocument * m_pDocument;
The app would only need to have the following to create a new view attached to the document:
void CWhateverApp::OnCreateView()
{
// creates the frame and associated view, attaches to document
CFrameWnd * pFrameWnd = m_pTemplate->CreateNewFrame( m_pDocument, NULL );
// error checking in case creation of frame or view fails
RETURN_ON_NULL( pFrameWnd );
// let the frame do any initialization the framework needs,
// call the view's OnInitialUpdate()
m_pTemplate->InitialUpdateFrame( pFrameWnd, m_pDocument );
}

Comments
There are no comments yet. Be the first to comment!