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.