VB高手教教我
来源:百度知道 编辑:UC知道 时间:2024/06/14 03:06:38
Private Sub Command1_Click()
Shell "Cmd /c ""ShutDown -s"""
End Sub
可以的,不同的系统代码不同,调用系统API即可。
Private Sub Command1_Click()
Shell "Cmd /c ""ShutDown -s"""
End Sub
'//或者要立即强行关闭计算机
Private Sub Command1_Click()
Shell "Cmd /c ""ShutDown -f"""
End Sub
Private Sub Command1_Click()
Shell "Cmd.exe /c shutdown -s -t 0" '-t 后面的0代表没有时间0秒就执行.
End Sub
以上的回答很难做到的,你将下面的代码复制到你的工程里就可以了。
Option Explicit
'关机声明
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVa