Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1069
  • Last Modified:

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!
0
jwilcox
Asked:
jwilcox
  • 3
  • 2
1 Solution
 
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
 
jwilcoxAuthor Commented:
Edited text of question
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
naveenkohliCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now