本文主要是介绍VB快速注销/重启/关闭计算机,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
快速关闭/重启计算机,核心代码:
Public Declare Function RtlAdjustPrivilege& Lib “ntdll” (ByVal Privilege&, ByVal NewValue&, ByVal NewThread&, OldValue&)
Public Declare Function NtShutdownSystem& Lib “ntdll” (ByVal ShutdownAction&)
Private Declare Function ExitWindowsEx Lib “user32” (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer
Const SE_SHUTDOWN_PRIVILEGE& = 19
Const shutdown& = 0
Const RESTART& = 1
Const EWX_FORCE& = 4
'过程
Public Sub TurboShutdown(Rbt As Long)
If Rbt > 0 Then RtlAdjustPrivilege SE_SHUTDOWN_PRIVILEGE, 1, 0, 0
Select Case Rbt
Case 0
Call ExitWindowsEx(EWX_FORCE, 0) '注销
Case 1
NtShutdownSystem RESTART '重启动
Case 2
NtShutdownSystem shutdown '关机
End Select
End Sub
下载地址:https://download.csdn.net/download/ty5858/20722290
这篇关于VB快速注销/重启/关闭计算机的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!