2个回答
展开全部
在公共标准模块中声明WIN API:
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
在按钮事件中用如下代码可关机:
Private Sub Command1_Click()
ExitWindowsEx 1, 0
End Sub
在按钮事件中用如下代码可重启:
Private Sub Command1_Click()
ExitWindowsEx 2, 0
End Sub
Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
在按钮事件中用如下代码可关机:
Private Sub Command1_Click()
ExitWindowsEx 1, 0
End Sub
在按钮事件中用如下代码可重启:
Private Sub Command1_Click()
ExitWindowsEx 2, 0
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询