Desktop Functions: Smart Device Functions:
|
ExitWindowsEx (user32)
C# Signature:
[DllImport("user32.dll", SetLastError = true)] Alternative C# Signature:
[DllImport("user32.dll", SetLastError = true)] VB Signature:
<DllImport("user32.dll", SetLastError:=True)> _ Alternative VB Signature:
Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Int32, ByVal dwReserved As Int32) As Int32 User-Defined Types:None. Notes:Parameters:
Tips & Tricks:To shut down or restart the system on NT/2K/XP, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege. If uFlags is set to 'LogOff', then the call will fail if the process calling it is a non-interactive-process (i.e a Windows Service). Read the ExitWindowsEx on MSDN for more info. All other values for uFlags work fine for non-interactive-processes. Sample Code:
class Class1 Alternative Managed API:Do you know one? Please contribute it! Page Change:Changed the sample code Reason parameter from "&" to "ShutdownReason.MajorOther | ShutdownReason.MinorOther". Amperstand (&) is the binary AND condition, and the values ANDed together would be zero. The intended condition is that the flags be ORed together. (|) Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more). |
|