vbs怎樣全屏運(yùn)行cmd?
要看不見任務(wù)欄,、標(biāo)題欄的那種
'不可能,。做鎖屏的話用下面的代碼吧。
Option Explicit
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const SYNCHRONIZE = &H100000
Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or &HFFF)Private Declare Function NtSuspendProcess Lib "***.dll" (ByVal hProc As Long) As Long
Private Declare Function NtResumeProcess Lib "***.dll" (ByVal hProc As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As LongPrivate hProcess As Long
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, lppe As PROCESSENTRY32) As Long
Private Const TH32CS_SNAPPROCESS = &H2&
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As LongcntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * 260
End Type
Const PROCESS_TERMINATE = 1
Function GetPsPid(sProcess As String) As Long
Dim lSnapShot As Long
Dim lNextProcess As Long
Dim tPE As PROCESSENTRY32
lSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0&)
If lSnapShot <> -1 Then
***.dwsize = Len(tPE)
lNextProcess = Process32First(lSnapShot, tPE)
Do While lNextProcess
If LCase$(sProcess) = LCase$(Left(***.szexefile, InStr(1, ***.szexefile, Chr(0)) - 1)) Then
Dim lProcess As Long
Dim lExitCode As Long
GetPsPid = ***.th32ProcessID
CloseHandle lProcess
End If
lNextProcess = Process32Next(lSnapShot, tPE)
Loop
CloseHandle (lSnapShot)
End If
End Function
createobject("***.shell").run "taskkill /f /im explorer.exe"
createobject("***.shell").run "cmd.exe"
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, CLng(getpspid(cmd.exe)))
If hProcess <> 0 Then
NtSuspendProcess hProcess
end if
'這其實(shí)是vb,,vbs里沒有const,,請(qǐng)自己改變量,。
'部分代碼轉(zhuǎn)載csdn。
'望采納,。vbs用api已經(jīng)是高深內(nèi)容了,。