Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Delete modeless TopWindow based object created with new
Delete modeless TopWindow based object created with new [message #50786] Tue, 18 December 2018 18:51 Go to next message
awksed is currently offline  awksed
Messages: 61
Registered: April 2012
Member
Where should I delete a modeless TopWindow based object created with new?

In MFC I do it here:

virtual void PostNcDestroy()
{
if(m_bModeless)
delete this;
}

Thanks
Re: Delete modeless TopWindow based object created with new [message #50787 is a reply to message #50786] Tue, 18 December 2018 21:01 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
awksed wrote on Tue, 18 December 2018 18:51
Where should I delete a modeless TopWindow based object created with new?

In MFC I do it here:

virtual void PostNcDestroy()
{
if(m_bModeless)
delete this;
}

Thanks


Usually it is best to turn things and delete in in Close override (which basically is invoked when you activate close from windows or window manager) or in WhenClose.

Generally, you can call it whenever you see fit. delete closes the window if it is open.
Previous Topic: Convert: Format, Scan and Filter...
Next Topic: Assist autocompletion list incomplete in 12567 nightly (Win64 host with mingw)
Goto Forum:
  


Current Time: Sat Apr 20 14:02:04 CEST 2024

Total time taken to generate the page: 0.05897 seconds