AllAPI Network - The KPD-Team

Allapi Network

 API List

API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
This Site
 Search Engine
 Contact Form

Donate to

How can I exit windows from my application?

Use the function ExitWindowsEx. This function has two parameters. The first is one or more flags to instruct windows how to shutdown. These are listed below along with the declarations. The second part of the function is reserved, and it set to zero. It is important to unload your application to help the system to shut down smoothly. The declarations for this function are below.

Public Const EWX_LOGOFF = 0 
Public Const EWX_SHUTDOWN = 1 
Public Const EWX_REBOOT = 2 
Public Const EWX_FORCE = 4                 

Declare Function ExitWindowsEx Lib "user32" Alias _
"ExitWindowsEx" (ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long                 

If you wanted to forcefully reboot the computer use the following code:

t& = ExitWindowsEx(EWX_FORCE OR EWX_REBOOT, 0)



Copyright © 1998-2007, The Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at