ericJA
April 16th, 1999, 08:44 PM
I have a book called Windows 98 How To and in it has a sample on loading a view frame, and I understand it but have a question on it:
In the a menu it loads the frame like so:
in the
void CCh92App::InitInstance()
{
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_CH92TYPE,
RUNTIME_CLASS(CCh92Doc),
RUNTIME_CLASS(CMDIChildWnd), // standard MDI child frame
RUNTIME_CLASS(CCh92View));
AddDocTemplate(pDocTemplate);
pDocTemplate1 = new CMultiDocTemplate(
IDR_CH92TYPE,
RUNTIME_CLASS(CCh92Doc),
RUNTIME_CLASS(CMDIChildWnd), // standard MDI child frame
RUNTIME_CLASS(CDialogView));
AddDocTemplate(pDocTemplate1);
...
...
}
I understandt that this code loads the frame, but what I cant find in
the code is the deletion of the instance doc. I remember somewhere that on a doc/view architecture MFC takes care of deleting the instance for you.
void CCh92App::OnDisplayFormWindow()
{
CCh92Doc *doc = new CCh92Doc("Form Window");
CFrameWnd *wnd = pDocTemplate1->CreateNewFrame(doc, NULL);
pDocTemplate1->InitialUpdateFrame(wnd, doc, TRUE);
}
Is this correct in my assumption, or do I have to delete it.
Thanks
In the a menu it loads the frame like so:
in the
void CCh92App::InitInstance()
{
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_CH92TYPE,
RUNTIME_CLASS(CCh92Doc),
RUNTIME_CLASS(CMDIChildWnd), // standard MDI child frame
RUNTIME_CLASS(CCh92View));
AddDocTemplate(pDocTemplate);
pDocTemplate1 = new CMultiDocTemplate(
IDR_CH92TYPE,
RUNTIME_CLASS(CCh92Doc),
RUNTIME_CLASS(CMDIChildWnd), // standard MDI child frame
RUNTIME_CLASS(CDialogView));
AddDocTemplate(pDocTemplate1);
...
...
}
I understandt that this code loads the frame, but what I cant find in
the code is the deletion of the instance doc. I remember somewhere that on a doc/view architecture MFC takes care of deleting the instance for you.
void CCh92App::OnDisplayFormWindow()
{
CCh92Doc *doc = new CCh92Doc("Form Window");
CFrameWnd *wnd = pDocTemplate1->CreateNewFrame(doc, NULL);
pDocTemplate1->InitialUpdateFrame(wnd, doc, TRUE);
}
Is this correct in my assumption, or do I have to delete it.
Thanks