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 Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Const PROCESS_QUERY_INFORMATION = &H400
Private Const STATUS_PENDING = &H103
Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = &HFFFFFFFF
Sub Main()
Dim tmpId As Long
Dim tmpHwnd As Long
tmpId = Shell(App.Path & "\AutoReg.bat")
tmpHwnd = OpenProcess(SYNCHRONIZE, 0, tmpId)
If tmpHwnd <> 0 Then
Call WaitForSingleObject(tmpHwnd, INFINITE)
Call CloseHandle(tmpHwnd)
End If
MsgBox "执行完毕 "
End Sub
vb6创建子进程并等待子进程的退出。
最新推荐文章于 2024-09-06 22:45:00 发布