Skip to content
This repository was archived by the owner on Nov 26, 2022. It is now read-only.

WinLib.ExitWindows

Andrew Lambert edited this page Jul 23, 2014 · 2 revisions

#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

Clone this wiki locally