Program crashes when closing a child
I'm working with my first MFC app, and I don't quite understand what's going on. I create my application and all that with no problems. I can create a child window smoothly (using the CMDIChildWnd class) and there are no problems. However, closing the child window under any means (close button at the top, closing the application, etc.) all cause an illegal operation error. As I said, I'm using the CMDIChildWnd class, and not some custom class derived from it. To create the child, I simply call child.Create(NULL,"Child window"); in the InitInstance for my application. child is a public member of that application. Any ideas as to what I'm missing, or should I post code, or what?
-Arek the Absolute
Gah! I forgot... That's not the code I'm using to create the child. I create the child with:
child.Create(NULL,"CHILD",WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW,child.rectDefault,GetMainWindow());
GetMainWindow returns a pointer to the CMDIFrameWnd derived parent window.
[edited by - Arek the Absolute on July 2, 2002 5:33:16 PM]
-Arek the Absolute"The full quartet is pirates, ninjas, zombies, and robots. Create a game which involves all four, and you risk being blinded by the sheer level of coolness involved." - Superpig
Solved my own problem. I took out child as a member of the class, and did this in InitInstance instead:
CMDIChildWnd *child = new CMDIChildWnd;
child->Create(NULL,"CHILD",WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW,child->rectDefault,GetMainWindow());
Thanks anyway!
-Arek the Absolute
CMDIChildWnd *child = new CMDIChildWnd;
child->Create(NULL,"CHILD",WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW,child->rectDefault,GetMainWindow());
Thanks anyway!
-Arek the Absolute
-Arek the Absolute"The full quartet is pirates, ninjas, zombies, and robots. Create a game which involves all four, and you risk being blinded by the sheer level of coolness involved." - Superpig
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement