1,488
社区成员
发帖
与我相关
我的任务
分享Option Explicit
Private Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Private Type PROCESS_INFORMATION '该结构用于容纳新进程的进程和线程标识符
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Private Type STARTUPINFO 'STARTUPINFO结构,其中包含了创建进程时使用的附加信息
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Byte
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type SECURITY_ATTRIBUTES '该参数定义了进程的安全特性
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Private Sub Command1_Click()
Dim psa As SECURITY_ATTRIBUTES
Dim tsa As SECURITY_ATTRIBUTES
Dim sinfo As STARTUPINFO
Dim pinfo As PROCESS_INFORMATION
CreateProcess vbNullString, "C:\Program Files\Internet Explorer\iexplore.exe", psa, tsa, 0, 0, 0&, "C:\Program Files\Internet Explorer\", sinfo, pinfo
End Sub