AdvApi32InitiateShutdown Method
Initiates a shutdown and restart of the specified computer,
and restarts any applications that have been registered for restart.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("AdvApi32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static uint InitiateShutdown(
string machineName,
string message,
int gracePeriod,
uint shutdownFlags,
uint reason
)
<DllImportAttribute("AdvApi32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function InitiateShutdown (
machineName As String,
message As String,
gracePeriod As Integer,
shutdownFlags As UInteger,
reason As UInteger
) As UInteger
Dim machineName As String
Dim message As String
Dim gracePeriod As Integer
Dim shutdownFlags As UInteger
Dim reason As UInteger
Dim returnValue As UInteger
returnValue = AdvApi32.InitiateShutdown(machineName,
message, gracePeriod, shutdownFlags,
reason)
public:
[DllImportAttribute(L"AdvApi32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static unsigned int InitiateShutdown(
String^ machineName,
String^ message,
int gracePeriod,
unsigned int shutdownFlags,
unsigned int reason
)
[<DllImportAttribute("AdvApi32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member InitiateShutdown :
machineName : string *
message : string *
gracePeriod : int *
shutdownFlags : uint32 *
reason : uint32 -> uint32
No code example is currently available or this language may not be supported.
- machineName String
-
The name of the computer to be shut down.
If the value of this parameter is , the local computer is shut down.
This parameter can be an addres, for example: 127.0.0.1
- message String
-
The message to be displayed in the interactive shutdown dialog box.
- gracePeriod Int32
-
The number of seconds to wait before shutting down the computer.
If the value of this parameter is zero, the computer is shut down immediately.
This value is limited to MAX_SHUTDOWN_TIMEOUT.
If the value of this parameter is greater than zero, and the shutdownFlags parameter
specifies the flag GRACE_OVERRIDE, the function fails and returns the error code ERROR_BAD_ARGUMENTS.
- shutdownFlags UInt32
-
Specifies options for the shutdown.
- reason UInt32
-
The reason for initiating the shutdown.
If this parameter is zero,
the default is an undefined shutdown that is logged as "No title for this reason could be found".
By default, it is also an 'unplanned' shutdown.
UInt32
If the function succeeds, it returns
ERROR_SUCCESS.