ID: Q130717
The information in this article applies to:
Console applications call SetConsoleCtrlHandler() to install or remove application-defined callback functions to handle console control signals. Typically, a console window with keyboard focus receives the CTRL_C_EVENT and CTRL_BREAK_EVENT signals when the CTRL+C and CTRL+BREAK keys are pressed or if they are generated using the GenerateConsoleCtrlEvent() function. But the system generates CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT signals when the user closes the console, logs off, or shuts down the system so that the console process has an opportunity to clean up before termination.
On Windows 95, a console application that has installed a control signal handler function only gets called for the CTRL_C_EVENT and CTRL_BREAK_EVENT signals; the signal handler function is never called for the CTRL_SHUTDOWN_EVENT, CTRL_LOGOFF_EVENT, and CTRL_CLOSE_EVENT signals.
Note that this problem does not occur under Windows NT versions 3.51 and 4.0.
The Windows 95 console system sends CTRL_C_EVENT and CTRL_BREAK_EVENT signals to console applications that have installed signal handers, but does not send CTRL_SHUTDOWN_EVENT, CTRL_LOGOFF_EVENT, or CTRL_CLOSE_EVENT signals.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
There is also another bug under Windows 95 that affects console applications that have installed a control signal handler. For more information on this bug, please refer to the following Knowledge Base article:
ARTICLE ID: Q134284
TITLE : BUG: Queued Console Control Signals May be Missed under
Windows 95
Additional query words: Win95 console event signal
Keywords : kbprg kbConsole kbKernBase kbGrpKernBase kbbuglist
Issue type : kbbug
Last Reviewed: March 7, 1997