|
Overview |
|
|
|
Group |
|
|
|
Quick Info
Windows NT
| Yes
| Win95
| Yes
| Win32s
| No
| Import Library
|
| Header File
| -
| Unicode
| No
| Platform Notes
| None
|
|
|
HandlerRoutine
A HandlerRoutine function is a function that a console process specifies to handle control
signals received by the process. The function can have any name.
BOOL HandlerRoutine(
DWORD dwCtrlType
| // control signal type
| );
|
|
Parameters
dwCtrlType
Indicates the type of control signal received by the handler. This value is
one of the following:
Signal
| Description
| CTRL_C_EVENT
| A CTRL+C signal was received, either from keyboard input or from a signal generated by
the GenerateConsoleCtrlEvent function.
| CTRL_BREAK_EVENT
| A CTRL+BREAK signal was received, either from keyboard input or from a signal generated by GenerateConsoleCtrlEvent.
| CTRL_CLOSE_EVENT
| A signal that the system sends to all processes attached to a console when the
user closes the console (either by choosing the Close command from the console
window's System menu, or by choosing the End Task command from the Task List).
| CTRL_LOGOFF_EVENT
| A signal that the system sends to all console processes when a user is logging
off. This signal does not indicate which user is logging off, so no
assumptions can be made.
| CTRL_SHUTDOWN_EVENT
| A signal that the system sends to all console processes when the system is
shutting down.
|
Return Values
If the function handles the control signal, it should return TRUE. If it
returns FALSE, the next handler function in the list of handlers for this process is
used.
Remarks
Each console process has its own list of HandlerRoutine functions. Initially, this list contains only a default handler function that
calls ExitProcess. A console process adds or removes additional handler functions by calling
the SetConsoleCtrlHandler function, which does not affect the list of handler functions for other
processes. When a console process receives any of the control signals, its handler
functions are called on a last-registered, first-called basis until one of the
handlers returns TRUE. If none of the handlers returns TRUE, the default handler
is called.
The CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT signals give
the process an opportunity to clean up before termination. A HandlerRoutine called to handle any of these signals can do one of the following after
performing any cleanup operations:
- Call the ExitProcess function to terminate the process.
- Return FALSE. If none of the registered handler functions returns TRUE, the
default handler terminates the process.
- Return TRUE. In this case, no other handler functions are called, and the
system displays a pop-up dialog box that asks the user whether to terminate the
process. The system also displays the dialog box if the process does not respond
within a certain time-out period (5 seconds for CTRL_CLOSE_EVENT, and 20 seconds
for CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT).
A process can use the SetProcessShutdownParameters function to prevent the CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT dialog box
from being displayed. In this case, the system just terminates the process when
a HandlerRoutine returns TRUE or when the time-out period elapses.
See Also
ExitProcess, GenerateConsoleCtrlEvent, GetProcessShutdownParameters, SetConsoleCtrlHandler, SetProcessShutdownParameters
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|