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 » Shutdown procedure by clicking red x
Re: Shutdown procedure by clicking red x [message #37778 is a reply to message #37776] Sun, 11 November 2012 23:58 Go to previous messageGo to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Try Thread::ShutdownThreads(); (or a global bool) with a Sleep time greater than any in your thread/s.


void endX(){
//	clean up code here	
	...	
	...
	Sleep(2000); // This is required
}	

GUI_APP_MAIN{
	NLNe().Run();
	Thread::ShutdownThreads();
	endX();
}


Then in each of your threads something like this with break; to close that thread from INSIDE that thread.
		while(!in.IsEof()){
    		if(Thread::IsShutdownThreads()){ // or you can use a global bool
	    	    in.Close();
	    	    break;
		    }


The code I posted in 2010 uses a global bool 'end' and in this code 'Thread::IsShutdownThreads'.
The 'endX();' could be replaced with Sleep(2000); unless you want to clean other stuff up.

Clicking the red x is the same as Break(); // Closes window with 'Cancel' AFAIR.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Copy\Paste Between Project Files Doesn't work
Next Topic: Error meaning
Goto Forum:
  


Current Time: Mon Apr 28 05:17:41 CEST 2025

Total time taken to generate the page: 0.04022 seconds