Shutdown Changes for Windows Vista

The following table summarizes the differences between shutdown on Windows Vista and Windows XP.

FeatureWindows XPWindows Vista
Blocking shutdownApplications can delay responding to WM_QUERYENDSESSION for 5 seconds, then the system allows the user to terminate the application. Applications that return TRUE in response to WM_QUERYENDSESSION can delay responding to WM_ENDSESSION for 5 seconds, then the system allows the user to terminate the application.Applications can delay responding to WM_QUERYENDSESSION for 5 seconds, then the system allows the user to continue or cancel shutdown. Applications that return TRUE in response to WM_QUERYENDSESSION can delay responding to WM_ENDSESSION for 5 seconds, then the system allows the user to continue or cancel shutdown.
Canceling shutdownIf an application returns FALSE in response to WM_QUERYENDSESSION, shutdown is canceled in most cases. However, no UI is displayed, so the user may not be aware that shutdown has been canceled.If an application returns FALSE in response to WM_QUERYENDSESSION, it still appears in the shutdown UI. Note that the system does not allow console applications or applications without a visible window to cancel shutdown. These applications are automatically terminated if they do not respond to WM_QUERYENDSESSION or WM_ENDSESSION within 5 seconds or if they return FALSE in response to WM_QUERYENDSESSION.
Shutdown user interfaceThe system displays a dialog box for each application blocking shutdown. If the user click the End Now button, the application is terminated. If the user clicks the Cancel button, shutdown is canceled and the application continues to run.The system displays a full-screen UI that identifies all applications blocking shutdown and their reasons for doing so (if they have registered a reason using ShutdownBlockReasonCreate).

 

Best Practices

  • Applications should not block shutdown. Respond to WM_QUERYENDSESSION as quickly as possible and postpone cleanup activities until processing the WM_ENDSESSION message.
  • Applications that must block shutdown should use the new ShutdownBlockReasonCreate function to register a string that explains the reason to the user. The user can decide whether to continue or cancel shutdown.
  • Applications cannot rely on being able to block shutdown.

 

 

Community Additions

ADD
Show:
© 2014 Microsoft