Anmerkung:
Console applications can use the
SetConsoleCtrlHandler function to receive shutdown notification.
Service applications can use the
RegisterServiceCtrlHandlerEx function to receive shutdown notifications in a handler routine.
.
Ausserdem:
Certain types of applications will no longer be allowed to block shutdown.
At shutdown, Windows Vista will check whether each running application is not responding (an application is defined as not responding if it has not responded to any of its window messages in the last 5 seconds), and, if so, automatically terminate it.
Windows Vista will also not allow console applications or applications that have no visible top-level windows to block shutdown. In most cases, such applications are less important to users at shutdown than applications that do have visible top-level windows. If an application without a visible top-level window blocks shutdown by vetoing WM_QUERYENDSESSION, or takes over 5 seconds to respond to WM_QUERYENDSESSION or WM_ENDSESSION, Windows will automatically terminate it.
However, if an application with no visible top-level windows uses the new
API to proactively indicate that it needs to block shutdown, Windows Vista will not automatically terminate it, and will instead treat it like an application that does have a visible top-level window.
Was für VISTA gilt ist auch für WIN 7 relevant.