CriticalShutdown method

The CriticalShutdown method forcefully closes all interactive applications and initiates a shutdown on a computer.

Syntax

HRESULT CriticalShutdown(
  [in]  LONG TimeOutInSeconds
);

Parameters

  • TimeOutInSeconds [in]
    The amount of time, in seconds, that the Shut Down dialog box is displayed. While the Shut Down dialog box is displayed, the shutdown request can be aborted by using the Console::AbortShutdown method.

    Note   In Windows Server 2003 and Windows XP with Service Pack 1 (SP1), the value of this parameter cannot be larger than MAX_SHUTDOWN_TIMEOUT seconds.

Return value

The CriticalShutdown method returns a standard HRESULT value.

Remarks

Unlike the Console::Shutdown method, the CriticalShutdown method automatically closes applications before it initiates a system shutdown.

If the TimeOutInSeconds parameter is not zero, the CriticalShutdown method displays a dialog box on the computer. The dialog box beeps when it is created and remains on top of other windows in the system. The dialog box prompts the user to log off, and can be moved but not closed. A timer counts down the remaining time before the system is shut down.

If TimeOutInSeconds is zero, the computer restarts without displaying the dialog box, and the system shutdown cannot be stopped by the Console::AbortShutdown method.

To use the CriticalShutdown method, the caller cannot be running as a service and should be running on the interactive console.

Note  If you use this method, you might lose work when applications are automatically closed.

See also

Console

Console::AbortShutdown

Console::Reboot

Console::Shutdown

 

 

Send comments about this topic to Microsoft

Build date: 1/12/2012