Declare Function ExitWindowsEx Lib "user32.dll" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
ExitWindowsEx shuts down or reboots the user's computer. The basic forms of it have the same effect as the options on the Windows Shut Down menu do. Of course, since the shutdown/reboot process will begin once the function is called, there won't normally be much left for your program to do. The function returns 0 if an error occured, or a non-zero value if successful.
Example:
' This will reboot the user's computer
x = ExitWindowsEx(EWX_REBOOT, 0)
If x = 0 Then Debug.Print "Reboot process failed."
Category: Miscellaneous
Back to the index.