使用ExitWindowsEx函数,函数有两个参数确定如何关闭Windows,其中第二个参数未使用设置为0 Public Const EWX_LOGOFF = 0 Public Const EWX_SHUTDOWN = 1 Public Const EWX_REBOOT = 2 Public Const EWX_FORCE = 4 Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long 'If you wanted to forcefully reboot the computer use the following code: '如果想强制重新启动计算机,函数应该这样使用: T& = ExitWindowsEx(EWX_FORCE Or EWX_REBOOT, 0)