From: baeman on
I have to create a new view, the following code creates a new document
of the DocTemplate which is
written in the second code part

####################################
Code:

void CNoNameApp::OnNewForceModel()
{
CForceModel_Doc* fModelDoc;

fModelDoc = (CForceModel_Doc*) pDocTemplateForceModel-

>CreateNewDocument();

CString title = "Force Model";
fModelDoc->setTitle(title);

// Create FormView
CDiagramFormFrameChild* pFormView = (CDiagramFormFrameChild*)
pDocTemplateForceModel->CreateNewFrame(fModelDoc, NULL);

pDocTemplateForceModel->InitialUpdateFrame(pFormView,fModelDoc,TRUE);

}

#########################


the doctemplate is implemented in the app

Code:
##########################
pDocTemplateForceModel = new CMultiDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CForceModel_Doc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CForceModel_View));
if (!pDocTemplateForceModel)
return FALSE;
AddDocTemplate(pDocTemplateForceModel);
##########################


I end up with an unhandled exception within the CreateNewFrame
function.
The doc template can't create a frame

Does someone have an idea why this is not working this time... and for
all my other views it's working fine?


thanks BaeMan
From: Ajay Kalra on
What does the exception say? Did you confirm that
pDocTemplateForceModel is valid? Step in debugger and see where does
the problem occur.

Also, since pDocTemplateForceModel is a class member, I would use
m_pDocTemplateForceModel as the name so that you can differentiate
between class members and local variables.

--
Ajay


On Aug 14, 4:47 am, baeman <bae...(a)gmx.net> wrote:
> I have to create a new view, the following code creates a new document
> of the DocTemplate which is
> written in the second code part
>
> ####################################
> Code:
>
> void CNoNameApp::OnNewForceModel()
> {
> CForceModel_Doc* fModelDoc;
>
> fModelDoc = (CForceModel_Doc*) pDocTemplateForceModel-
>
> >CreateNewDocument();
>
> CString title = "Force Model";
> fModelDoc->setTitle(title);
>
> // Create FormView
> CDiagramFormFrameChild* pFormView = (CDiagramFormFrameChild*)
> pDocTemplateForceModel->CreateNewFrame(fModelDoc, NULL);
>
> pDocTemplateForceModel->InitialUpdateFrame(pFormView,fModelDoc,TRUE);
>
> }
>
> #########################
>
> the doctemplate is implemented in the app
>
> Code:
> ##########################
> pDocTemplateForceModel = new CMultiDocTemplate(IDR_MAINFRAME,
>                 RUNTIME_CLASS(CForceModel_Doc),
>                 RUNTIME_CLASS(CChildFrame),
>                 RUNTIME_CLASS(CForceModel_View));
>         if (!pDocTemplateForceModel)
>                 return FALSE;
>         AddDocTemplate(pDocTemplateForceModel);
> ##########################
>
> I end up with an unhandled exception within the CreateNewFrame
> function.
> The doc template can't create a frame
>
> Does someone have an idea why this is not working this time... and for
> all my other views it's working fine?
>
> thanks BaeMan