ExitWindowsEx(flags, reserved)
either logs off the current user, shuts down the system, or shuts down and restarts
the system.
Parameters
flags : int
The shutdown operationreserved=0 : int
Comments
It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.
Win32 API References
Search for AbortSystemShutdown at msdn, google or google groups.