Win98 console application shutdown question
 
Howdy,
I have an MFC program that spawns a console program with CreateProcess.  I 
find that on Windows 98  I don't know how to programatically shutdown this 
console app when the user selectes "shutdown" or "reset" for Windows.  This 
isn't a problem on Win2K or latter.  In those systems the MFC sets an event 
that shuts down the console when it gets the shutdown messages.
I first tried using
const BOOL bHandler = SetConsoleCtrlHandler(
(PHANDLER_ROUTINE) CtrlHandler, // handler function
TRUE); // add to list
ASSERT(bHandler);
and
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
{
printf("Console handler called\n"); //never called
switch (fdwCtrlType)
{
// Handle console events.
case CTRL_C_EVENT:
case CTRL_CLOSE_EVENT:
case CTRL_BREAK_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
default: ;
}
// set an event that shuts down the main application
SetEvent(g_hShutdownEvent);
return FALSE;
}
My CtrlHandler is never called under Windows 98.
I then tried giving my console app a hidden window, but that didn't work 
either.  After user requested shutdown I don't get any messages into my 
hidden window until after Windows puts up that "you must quit this program 
before you quit windows" message box
It looks like when the user selects shutdown and Windows 98 sees a console 
app, it immediately puts up its own message box.  It doesn't seem to pass 
go, collect $200, or give me a chance to shutdown my console gracefully.  Is 
this in fact the case?
thanks
Jim Howard