新建一工程,添加一个command按钮控件,拷贝下列代码,运行,点按钮就会快速关机
Private Declare Function RtlAdjustPrivilege& Lib "ntdll" (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)
Private Declare Function NtShutdownSystem& Lib "ntdll" (ByVal ShutdownAction&)
Private Sub Command1_Click()
RtlAdjustPrivilege 19, 1, 0, 0
NtShutdownSystem 0
End Sub