Added: Apr 28, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Windows API Guide: ExitWindowsEx Function Platforms: Win 95/98, Win NT ExitWindowsEx shuts down or reboots the user's computer. 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 1 if successful. uFlagsOne or more of the following flags specifying how to shut down or reboot the computer: EWX_FORCE = 4Force any applications to quit instead of prompting the user to close them. EWX_LOGOFF = 0Log off the network. EWX_POWEROFF = 8Shut down the system and, if possible, turn the computer off. EWX_REBOOT = 2Perform a full reboot of the system. EWX_SHUTDOWN = 1Shut down the system. dwReservedReserved for future versions of Windows. Always set to 0.
Highlight all by clicking in box
' Reboot the computer, forcing any open programs to close
Dim retval As Long ' return value
retval = ExitWindowsEx(EWX_REBOOT Or EWX_FORCE, 0)
If retval = 0 Then Debug.Print "Reboot attempt failed.";
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.