Determine when process ends. 
Author Message
 Determine when process ends.

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.



Fri, 06 Jul 2001 03:00:00 GMT  
 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.



Sat, 07 Jul 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help with Determining Shell Process Ends

2. How a 32-Bit App Can Determine When a Shelled Process Ends, Article ID: Q129796

3. How a 32-Bit App Can Determine When a Shelled Process Ends

4. Determine When shelled process end

5. Determining when a shelled process ends

6. How a 32-Bit APP can Determine When a Shelled Process Ends - Q129796

7. Help: How a 32-Bit app can determine when a shelled process ends

8. API code for Ending a process in NT TaskMgr/Processes Tab

9. How to End Processes

10. Why wait the end of a Shell process ?

11. How to determe when a SHELLed process ends.

12. end a process

 

 
Powered by phpBB® Forum Software