Solved

DYNCREATE

Posted on 1998-03-13
6
1,032 Views
Last Modified: 2013-11-19
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
Comment
Question by:jwilcox
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:AlFa
ID: 1316967
your MainWnd is private derived of CFrameWnd

class  MainWnd : CFrameWnd

just do this
class  MainWnd : public CFrameWnd


0
 
LVL 1

Author Comment

by:jwilcox
ID: 1316968
Sorry, its declared as MainWnd: public CFrameWnd, just an oversight on my part.
0
 
LVL 1

Author Comment

by:jwilcox
ID: 1316969
Edited text of question
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Expert Comment

by:AlFa
ID: 1316970
Do you have a creator and a destructor?

If you do not need one  declare an empty one :

MainWnd(){};
virtual ~MainWnd(){};
0
 
LVL 1

Author Comment

by:jwilcox
ID: 1316971
Yeah I do have a destructor and a constructor, thanks for your help anyways, though.

          Jason
0
 
LVL 23

Accepted Solution

by:
naveenkohli earned 30 total points
ID: 1316972
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question