DYNCREATE

I'm trying to user DYNCREATE in my MFC Application, unfortunatly I get the following errors:
Error C2509: 'CreateObject': member function not declared in MainWnd
Error C2509: '_GetBaseClass': member function not declared in MainWnd
Error C2039: 'classMainWnd: is not a member of MainWnd
Error C2248: '_GetBaseClass': cannot access protected member declared in class 'CFrameWnd'

MainWnd is delcared as MainWnd : public CFrameWnd
and I have IMPLEMENT_DYNCREATE(MainWnd, CFrameWnd) in my implementation file and DECLARE_DYNCREATE(MainWnd)

Any help would be appreciated!
LVL 1
jwilcoxAsked:
Who is Participating?
 
naveenkohliConnect With a Mentor Commented:
You have entered into deep troubled water of DYNCREATE macro. It shuld not be much of a hassle to come out of it.
Somehow your MainWnd () class is not able to find it parent window i.e. CObject because thats where DYNCREATE macro are implemented. Just go thru ur code and try to trace if you can reach back to cObject. Hopefully that shuld sole ur problem
The way its implemented is

CRuntimeClass * pRuntimeClass = RUNTIME_CLASS (CYourClass);
CObject *pObject = pRuntimeClass->CreateObject ();
ASSERT (pObject->IsKindOf (RUNTIME_CLASS (CYourClass));


0
 
AlFaCommented:
your MainWnd is private derived of CFrameWnd

class  MainWnd : CFrameWnd

just do this
class  MainWnd : public CFrameWnd


0
 
jwilcoxAuthor Commented:
Sorry, its declared as MainWnd: public CFrameWnd, just an oversight on my part.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jwilcoxAuthor Commented:
Edited text of question
0
 
AlFaCommented:
Do you have a creator and a destructor?

If you do not need one  declare an empty one :

MainWnd(){};
virtual ~MainWnd(){};
0
 
jwilcoxAuthor Commented:
Yeah I do have a destructor and a constructor, thanks for your help anyways, though.

          Jason
0
All Courses

From novice to tech pro — start learning today.