Dynamic Object Creation, ok. What about destruction?
-
Hi, I created an instance of my CFrameWnd-derived class with: CRuntimeClass* pRuntimeClass=RUNTIME_CLASS(CMainWindow); CObject* pObject=pRuntimeClass->CreateObject(); ASSERT(pObject->IsKindOf(RUNTIME_CLASS(CMainWindow))); CMainWindow* mainWindow=(CMainWindow*)pObject; How can I destroy this object at the end of my application? delete mainWindow does obviously not work. Is there maybe a function similar to CreateObject() which destroys it? Thank you :)
-
Hi, I created an instance of my CFrameWnd-derived class with: CRuntimeClass* pRuntimeClass=RUNTIME_CLASS(CMainWindow); CObject* pObject=pRuntimeClass->CreateObject(); ASSERT(pObject->IsKindOf(RUNTIME_CLASS(CMainWindow))); CMainWindow* mainWindow=(CMainWindow*)pObject; How can I destroy this object at the end of my application? delete mainWindow does obviously not work. Is there maybe a function similar to CreateObject() which destroys it? Thank you :)
I am not sure what you are trying to do, but your main frame window gets destroyed when the app exits and vice versa. Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
I am not sure what you are trying to do, but your main frame window gets destroyed when the app exits and vice versa. Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
Thank you for your reply. I also thought that the window would automatically get destroyed, but in debug mode it tells me that it detected memory leaks (the CFrameWnd and its toolbar)
IMO the automatic memory leak detection detects more than is there. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002 -
IMO the automatic memory leak detection detects more than is there. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002