前端之家收集整理的这篇文章主要介绍了
vb6创建子进程并等待子进程的退出。,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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,tmpId)
If tmpHwnd <> 0 Then
Call WaitForSingleObject(tmpHwnd,INFINITE)
Call CloseHandle(tmpHwnd)
End If
MsgBox "执行完毕 "
End Sub
原文链接:https://www.f2er.com/vb/260301.html