|
Private Declare Function InitiateSystemShutdown _
Lib "advapi32.dll" Alias "InitiateSystemShutdownA" _ (ByVal lpMachineName As String, _ ByVal lpMessage As String, ByVal dwTimeout As Integer, _ ByVal bForceAppsClosed As Long, _ ByVal bRebootAfterShutdown As Long) As Long Private Declare Function AbortSystemShutdown _ Lib "advapi32.dll" Alias "AbortSystemShutdownA" _ ByVal lpMachineName As String) As Long Public Function ShutDownComputer(CompName as String, _ MessageToUser as String, SecondsUntilShutdown as Long, _ ForceAppsClosed as Integer, RebootAfter as Integer) ShutDownComputer = InitiateSystemShutdown(CompName, _ MessageToUser, SecondsUntilShutdown, _ ForceAppsClosed, RebootAfter) End Function Public Function AbortShutdown(CompName as String) AbortShutdown = AbortSystemShutdown(ComName) End Function ' NOTES: ' + Shutdown can only be aborted while the countdown is going. ' + Both Functions return "0" when failed, "1" when Successful |