WinLib.ExitWindows - charonn0/WinLib GitHub Wiki

#WinLib.ExitWindows

##Method Signature

Protected Function ExitWindows(Mode As Integer, Reason As Integer, ForceIfHung As Boolean) As Integer

##Parameters

Name Type Comment
Mode Integer The exit mode (see notes)
Reason Integer The reason code (see notes)
ForceIfHung Boolean Kills unresponsive processes

##Return value Returns 0 on success, or a Win32 error number.

##Notes Shuts down, reboots, or logs off the computer. Returns 0 on success, or a Win32 error code on error.

Reason may be any of major and minor reason code specified on MSDN combined using a bitwise Or operation.

If ForceIfHung is True then Windows forces processes to terminate if they do not respond to end-of-session messages within a timeout interval.

Mode can be one of the following constants:

  • EWX_LOGOFF (all Windows versions)
  • EWX_REBOOT (all Windows versions)
  • EWX_SHUTDOWN (all Windows versions)
  • EWX_HYBRID_SHUTDOWN
  • EWX_POWEROFF
  • EWX_RESTARTAPPS

##See also