Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

ExitWindowsEx (aygshell)
 

aygshell is for smart devices, not desktop Windows. Therefore, this information only applies to code using the .NET Compact Framework. To see if information for ExitWindowsEx in other DLLs exists, click on Find References to the right.

.
Summary
This function shuts down the system

C# Signature:

[DllImport("aygshell.dll", SetLastError=""true"")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool ExitWindowsEx([MarshalAs(UnmanagedType.U4)]uint dwFlags, [MarshalAs(UnmanagedType.U4)]uint dwReserved);

[DllImport("aygshell.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool ExitWindowsEx([MarshalAs(UnmanagedType.U4)] ExitWindowsAction uFlags, [MarshalAs(UnmanagedType.U4)] uint dwReserved);

VB Signature:

Declare Function ExitWindowsEx Lib "aygshell.dll" (ByVal dwFlags As Integer, ByVal dwReserved As Integer) As Boolean

User-Defined Types:

enum ExitWindowsAction : uint

    {
    EWX_LOGOFF = 0,
    EWX_SHUTDOWN = 1,
    EWX_REBOOT = 2,
    EWX_FORCE = 4,
    EWX_POWEROFF = 8
    }

Alternative Managed API:

There is no alternative managed API function

Notes:

Parameters:

    uFlags
        Specifies the type of shutdown. This parameter must be one of the following values:
        EWX_POWEROFF - Shuts down the system and turns off the power. ""Note:"" This flag is not supported on a Windows Mobile-based Pocket PC.
        EWX_REBOOT - Shuts down the system and reboots.
    dwReserved
        Reserved; this parameter is ignored

Tips & Tricks:

Available only at Windows Mobile 5.0 or later. The ExitWindowsEx function returns as soon as it has initiated the shutdown. The shutdown then proceeds asynchronously. Because the function executes asynchronously, a nonzero return value indicates that the shutdown has been initiated. It does not indicate whether the shutdown will succeed. It is possible that the system, the user, or another application will abort the shutdown.

Sample Code:

static void Main(string[] args)

{

    ExitWindowsEx(ExitWindowsAction.EWX_REBOOT, 0);

}

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

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).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions