发表评论(0)作者:, 平台:, 阅读:10996, 日期:2000-03-12
直接呼叫RUNDLL来关机
不需任何API调用,直接一行语句就可关机!
shell "c:\windows\rundll.exe user.exe,exitwindowsexec"
'重新启动计算机
shell "c:\windows\rundll.exe user.exe,exitwindows"
'关闭计算机
对于那些Windows安装目录不是c:\windows计算机来说,调用API很容易找到。下面
给出找Windows目录的例子,变量strWinDir用来存放找到的Windows目录。
Public Const MAX_PATH = 260
Declare Function GetWindowsDirectory Lib "kernel32" Alias "
GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
Long
Sub GetWinDir()
Dim S As String, Length As Long , strWinDir As String
S = String(MAX_PATH, 0)
Length = GetWindowsDirectory(S, MAX_PATH)
strWinDir = Left(S, InStr(S, Chr(0)) - 1)
End Sub
不需任何API调用,直接一行语句就可关机!
shell "c:\windows\rundll.exe user.exe,exitwindowsexec"
'重新启动计算机
shell "c:\windows\rundll.exe user.exe,exitwindows"
'关闭计算机
对于那些Windows安装目录不是c:\windows计算机来说,调用API很容易找到。下面
给出找Windows目录的例子,变量strWinDir用来存放找到的Windows目录。
Public Const MAX_PATH = 260
Declare Function GetWindowsDirectory Lib "kernel32" Alias "
GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As
Long
Sub GetWinDir()
Dim S As String, Length As Long , strWinDir As String
S = String(MAX_PATH, 0)
Length = GetWindowsDirectory(S, MAX_PATH)
strWinDir = Left(S, InStr(S, Chr(0)) - 1)
End Sub