Alt+F4 doesn't call game shutdown, results in 'not in bins'
by Matt Jones - · in Torque Game Engine · 12/06/2003 (11:43 pm) · 3 replies
When the user hits alt + F4, the game doesn't shutdown correctly and this results in the 'not in bins' message. If you leave the game by exiting the mission and pressing the quit button, then everything gets cleaned up right and you don't get the message.
I tried adding code to winWindow.cc (around line 520) to handle alt F4 but I don't know enough about the engine to get it to shut down correctly:
I tried adding code to winWindow.cc (around line 520) to handle alt F4 but I don't know enough about the engine to get it to shut down correctly:
case WM_SYSCOMMAND:
switch(wParam)
{
// start new code
/*
case SC_CLOSE: // handle an alt F4 command
{
// clean up before we handle alt+F4 so we don't get a bunch
// of 'not in bins' messages
// posting an event is not strong enough, windows kills the process before
// the cleanup code gets run but strangely it doesn't kill it so fast
// that it prevents the bins error messages
//Event quitEvent;
//quitEvent.type = QuitEventType;
//Game->postEvent(quitEvent);
// the other strategies I tried were too strong and resulted in the
// telConsole code thread getting into an invalid state because
// threads have to be synchronized or something
//Game->forceShutdown();
//break;
//return 0;
}
*/
// end new code
case SC_SCREENSAVE:
case SC_MONITORPOWER:
if(GetForegroundWindow() == winState.appWindow)
{
return 0;
}
break;
}
break;
Torque Owner Mark Harmon
case WM_CLOSE: { // generate a quit event Event quitEvent; quitEvent.type = QuitEventType; Game->postEvent(quitEvent); //PostQuitMessage(0); } break;I ran it in the debugger with a break point at shutdownGame(); (around line 483 in main.cc) and it always makes it there before terminating. No 'not in bins' messages either.