Here code for You
You can use API to handle Process
VB Code:
Public Const STATUS_PENDING = &H103&
Public Const PROCESS_QUERY_INFORMATION = &H400
Public Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
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 hFile As Long) As Long
Public Sub subStartAndWait(cmdline As String)
Dim hProcess As Long
Dim ProcessId As Long
Dim exitCode As Long
On Local Error GoTo ErrorLine
ProcessId = Shell(cmdline, 1)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
Do
Call GetExitCodeProcess(hProcess, exitCode)
DoEvents
Loop While exitCode = STATUS_PENDING
Call CloseHandle(hProcess)
MsgBox "The shelled process " & cmdline & " has ended."
ErrorLine:
End Sub
oh1mie/Vic