GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Nov-2007, 17:27
Algar Algar is offline
Junior Member
 
Join Date: Sep 2007
Posts: 94
Algar will become famous soon enough

Click X in window won't destroy itself ?


I am making a dialog based application and I am trying to jump around from window to window using the following Idea:

create a new window. (modeless)
endcurrent window with this->EndDialog(0);

I am not really sure whats happening, but it seems somewhere windows are not being killed propertly. or something is using a lot more memory then it should. Basically I think it could be 2 things.

#1 Does EndDialog free any memory that it uses, or just hide the window ?
#2 Does pressing the X to close the window destroy it completely, or do I need to do "delete" on it ?
  #2  
Old 01-Nov-2007, 22:45
Kimmo Kimmo is offline
Regular Member
 
Join Date: Mar 2007
Location: Finland
Posts: 349
Kimmo is a jewel in the roughKimmo is a jewel in the roughKimmo is a jewel in the rough

Re: Click X in window won't destroy itself ?


Don't know if it helps, but with a quick look it says everywhere EndDialog() is used for modal dialogs. Maybe you could try DestroyWindow() ?
  #3  
Old 02-Nov-2007, 10:47
Algar Algar is offline
Junior Member
 
Join Date: Sep 2007
Posts: 94
Algar will become famous soon enough

Re: Click X in window won't destroy itself ?


On msdn it says the destroy window doesn't destroy the CWnd object.

I guess my problem is in the main design. If I create a window from a window,then destroy the first window, i've lost the pointer and can't delete the second one. I'm not sure how to get around that, cause its kind of a chain of windows, each one passing information to the next via CWnd derived class constructor.
  #4  
Old 02-Nov-2007, 11:24
Kimmo Kimmo is offline
Regular Member
 
Join Date: Mar 2007
Location: Finland
Posts: 349
Kimmo is a jewel in the roughKimmo is a jewel in the roughKimmo is a jewel in the rough

Re: Click X in window won't destroy itself ?


Isn't the window an object then? If it is, you can get its address with the this pointer. So pass that address to the next window, or create some kind of a window creater function that deletes the former window and creates a new one. Maybe?
  #5  
Old 02-Nov-2007, 11:34
Algar Algar is offline
Junior Member
 
Join Date: Sep 2007
Posts: 94
Algar will become famous soon enough

Re: Click X in window won't destroy itself ?


err, yes of course, didn't think of that, so simple

Ill try that, thanks a lot !
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Traditional Win32 programming vs. wxWidgets Zorachus C++ Forum 2 10-Feb-2007 17:54
how to detect mouse click in child window created by CHTMLEDITVIEW terr MS Visual C++ / MFC Forum 0 08-Sep-2006 13:12
need help with a console menu system BullBuchanan C++ Forum 6 20-Aug-2006 14:46
Win32 Window Shading behavior (like linux) WillyumYum C++ Forum 3 18-Apr-2005 14:36
Changing window start colour Rosdahale C++ Forum 5 19-Jan-2005 15:51

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 09:36.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.