I have investigated further, this is to do with a bug in windows 9x where if
multiple messages are sent to the console control at the same time they get
ignored. This means the messages are never recieved by the application. I
dont know waht to do now. Im working on pre ME so im not sure waht my
options are. I am running a separate application that is running as a
windows application, maybe i could authorise the shutdown of the client from
this other program, but if no messages are being recieved how is this going
to help? I guess i could launch the console part as a child process but im
not sure how that would work.
Have other people here had this problem? What path have you taken to solve
this?
Jamie
"Jammie" <ja****@dsl.pipex.com> wrote in message
news:J7********************@pipex.net...
Set ConsoleCtrlHandler is set.
The code in question is the following:
BOOL WINAPI ConsoleControlHandler ( DWORD dwCtrlType ){
BOOL bReturnStatus = FALSE;
switch( dwCtrlType ){
case CTRL_C_EVENT:
if(gstate.activities_suspended) {
resume_client();
} else {
suspend_client();
}
bReturnStatus = TRUE;
break;
case CTRL_BREAK_EVENT:
case CTRL_CLOSE_EVENT:
case CTRL_SHUTDOWN_EVENT:
quit_client();
bReturnStatus = TRUE;
break;
case CTRL_LOGOFF_EVENT:
if (!gstate.executing_as_daemon) {
quit_client();
}
bReturnStatus = TRUE;
break;
}
return bReturnStatus;
}
When i run the application on windows 98 the above code does not seem to
run when a shutdown or logoff action is taken. Does anyone have any
idea's?
Jamie
"Jochen Kalmbach [MVP]" <no********************@holzma.de> wrote in
message news:%2****************@tk2msftngp13.phx.gbl... Hi Jammie!
I have a major problem with my application. For some reason on win9x my
application will not exit properly when the user shuts down there
system. This doesnt seem to be a problem on XP. My application in
question is a command prompt based app. For some reason the application
does not seem to recieve its termination signal. Is this a known problem
with win9x systems and if so is there a way to work arround it?
You have correctly called "SetConsoleCtrlHandler", or?
See: SetConsoleCtrlHandler
http://msdn.microsoft.com/library/en...trlhandler.asp
Then normaly it should work.
I suppose, that after you receive the End-Event, you do not terminate
correctly...
--
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/