
Determine when process ends.
Try This
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As
Long, _
ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long)
As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As
Long, _
ByVal dwMilliseconds As Long) As Long
Public Const SYNCHRONIZE = &H100000
Private Sub Command1_Click(Index As Integer)
Dim pid As Long
Dim hProcess As Long
sProg = Command1(Index).Caption & ".exe"
pid = Shell("C:\WHATEVER.EXE", vbNormalFocus)
hProcess = OpenProcess(SYNCHRONIZE, True, pid)
Do Until (hProcess = 0 Or WaitForSingleObject(hProcess, 60000) = 0)
DoEvents
Loop
CloseHandle hProcess
End Sub
Quote:
>Hi guys & girls .
>I need help with this .
>i creat an application that calls to another application which is a setup
>program of something.
>i used the CreateProcessA function to call and creat the setup program ,
but
>after the setup started the program just disapear
>and fialed to respond.
>When i F8 to run the program step by step , it works fine !!!!
>All i wanted is to run the setup program from within visual basic
>application, and to determine when it stop so i can come back to my
>application.
> Thanks.