From: MuMbi on
Hi.

I created MDI project.

the project provided CChildFrame as default.

I need other doc template and child frame.

So I added doc template on App::InitInstance() like this.

m_pColladaDocTemplate = new CMultiDocTemplate( IDR_ColladaTYPE,
RUNTIME_CLASS( CColladaDoc ),
RUNTIME_CLASS( CColladaFrame ),
RUNTIME_CLASS( CColladaView ) );

CColladaDoc, CColladaFrame, CColladaView are new classes defined by me.

This is a problem.

RUNTIME_CALSS( CColladaFrame ) returns CRuntimeClass.

the CRuntimeClass has m_pfnCreateObject that is default constructor pointer.

But, the m_pfnCreateObject was NULL.

I tried changing frame class to CChildFrame.

In this case, the m_pfnCreateObject was not NULL rightly.


What problem does My CColladaFrame have?

I think I'am missing something out.

Waiting your helps.


From: Joseph M. Newcomer on
You missed three critical pieces of information here:

what is the runtime type of the document, frame, and view. It should be DECLARE_DYNCREATE
or DECLARE_SERIAL, with a corresponding IMPLEMENT_DYNCREATE or IMPLEMENT_SERIAL.

So you need to examine the header files for each of these classes and make sure they
correspond to the requirements for a dynamic template.
joe

On Tue, 2 Feb 2010 18:47:02 -0800, MuMbi <MuMbi(a)discussions.microsoft.com> wrote:

>Hi.
>
>I created MDI project.
>
>the project provided CChildFrame as default.
>
>I need other doc template and child frame.
>
>So I added doc template on App::InitInstance() like this.
>
>m_pColladaDocTemplate = new CMultiDocTemplate( IDR_ColladaTYPE,
> RUNTIME_CLASS( CColladaDoc ),
> RUNTIME_CLASS( CColladaFrame ),
> RUNTIME_CLASS( CColladaView ) );
>
>CColladaDoc, CColladaFrame, CColladaView are new classes defined by me.
>
>This is a problem.
>
>RUNTIME_CALSS( CColladaFrame ) returns CRuntimeClass.
>
>the CRuntimeClass has m_pfnCreateObject that is default constructor pointer.
>
>But, the m_pfnCreateObject was NULL.
>
>I tried changing frame class to CChildFrame.
>
>In this case, the m_pfnCreateObject was not NULL rightly.
>
>
>What problem does My CColladaFrame have?
>
>I think I'am missing something out.
>
>Waiting your helps.
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: MuMbi on
Theses classes was created automatically by Wizard provided from VisualStudio.

So, They already have MACROs you mentioned.

I tried copying & pasting CChildFrame contents in .h, .cpp files to My
CColladaFrame files and changing the class name to CColladaFrame.

Then, it works well!

I can't find difference between old CColladaFrame and new.

It looks same.

I feel frustrated sadly. T_T




"Joseph M. Newcomer" wrote:

> You missed three critical pieces of information here:
>
> what is the runtime type of the document, frame, and view. It should be DECLARE_DYNCREATE
> or DECLARE_SERIAL, with a corresponding IMPLEMENT_DYNCREATE or IMPLEMENT_SERIAL.
>
> So you need to examine the header files for each of these classes and make sure they
> correspond to the requirements for a dynamic template.
> joe
>
> On Tue, 2 Feb 2010 18:47:02 -0800, MuMbi <MuMbi(a)discussions.microsoft.com> wrote:
>
> >Hi.
> >
> >I created MDI project.
> >
> >the project provided CChildFrame as default.
> >
> >I need other doc template and child frame.
> >
> >So I added doc template on App::InitInstance() like this.
> >
> >m_pColladaDocTemplate = new CMultiDocTemplate( IDR_ColladaTYPE,
> > RUNTIME_CLASS( CColladaDoc ),
> > RUNTIME_CLASS( CColladaFrame ),
> > RUNTIME_CLASS( CColladaView ) );
> >
> >CColladaDoc, CColladaFrame, CColladaView are new classes defined by me.
> >
> >This is a problem.
> >
> >RUNTIME_CALSS( CColladaFrame ) returns CRuntimeClass.
> >
> >the CRuntimeClass has m_pfnCreateObject that is default constructor pointer.
> >
> >But, the m_pfnCreateObject was NULL.
> >
> >I tried changing frame class to CChildFrame.
> >
> >In this case, the m_pfnCreateObject was not NULL rightly.
> >
> >
> >What problem does My CColladaFrame have?
> >
> >I think I'am missing something out.
> >
> >Waiting your helps.
> >
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> .
>
From: Joseph M. Newcomer on
I wasn't sure if you were using VS to create them; there are a set of people out there who
refuse to use the tools, and this is the most common mistake they make.

More below...
On Tue, 2 Feb 2010 21:34:01 -0800, MuMbi <MuMbi(a)discussions.microsoft.com> wrote:

>Theses classes was created automatically by Wizard provided from VisualStudio.
>
>So, They already have MACROs you mentioned.
>
>I tried copying & pasting CChildFrame contents in .h, .cpp files to My
>CColladaFrame files and changing the class name to CColladaFrame.
****
So what is different? Clearly something is, so all you need to do is compare the two
files and see!
joe
****
>
>Then, it works well!
>
>I can't find difference between old CColladaFrame and new.
>
>It looks same.
>
>I feel frustrated sadly. T_T
>
>
>
>
>"Joseph M. Newcomer" wrote:
>
>> You missed three critical pieces of information here:
>>
>> what is the runtime type of the document, frame, and view. It should be DECLARE_DYNCREATE
>> or DECLARE_SERIAL, with a corresponding IMPLEMENT_DYNCREATE or IMPLEMENT_SERIAL.
>>
>> So you need to examine the header files for each of these classes and make sure they
>> correspond to the requirements for a dynamic template.
>> joe
>>
>> On Tue, 2 Feb 2010 18:47:02 -0800, MuMbi <MuMbi(a)discussions.microsoft.com> wrote:
>>
>> >Hi.
>> >
>> >I created MDI project.
>> >
>> >the project provided CChildFrame as default.
>> >
>> >I need other doc template and child frame.
>> >
>> >So I added doc template on App::InitInstance() like this.
>> >
>> >m_pColladaDocTemplate = new CMultiDocTemplate( IDR_ColladaTYPE,
>> > RUNTIME_CLASS( CColladaDoc ),
>> > RUNTIME_CLASS( CColladaFrame ),
>> > RUNTIME_CLASS( CColladaView ) );
>> >
>> >CColladaDoc, CColladaFrame, CColladaView are new classes defined by me.
>> >
>> >This is a problem.
>> >
>> >RUNTIME_CALSS( CColladaFrame ) returns CRuntimeClass.
>> >
>> >the CRuntimeClass has m_pfnCreateObject that is default constructor pointer.
>> >
>> >But, the m_pfnCreateObject was NULL.
>> >
>> >I tried changing frame class to CChildFrame.
>> >
>> >In this case, the m_pfnCreateObject was not NULL rightly.
>> >
>> >
>> >What problem does My CColladaFrame have?
>> >
>> >I think I'am missing something out.
>> >
>> >Waiting your helps.
>> >
>> Joseph M. Newcomer [MVP]
>> email: newcomer(a)flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>> .
>>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm