快速关闭/重启计算机,核心代码:
Public Declare Function RtlAdjustPrivilege& Lib “ntdll” (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)
Public Declare Function NtShutdownSystem& Lib “ntdll” (ByVal ShutdownAction&)
Public Const SE_SHUTDOWN_PRIVILEGE& = 19
Public Const shutdown& = 0
Public Const RESTART& = 1
'过程
Public Sub TurboShutdown(Rbt As Boolean)
RtlAdjustPrivilege SE_SHUTDOWN_PRIVILEGE, 1, 0, 0
If Rbt Then
NtShutdownSystem RESTART '重启动
Else
NtShutdownSystem shutdown '关机
End If
End Sub
下载地址:https://download.csdn.net/download/ty5858/20722290