Start new application and wait for it to finish
The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.
Private Declare Function OpenProcess Lib "kernel32" ( ByVal dwDesiredAccess As Long , ByVal bInheritHandle As Long , ByVal dwProcessId As Long ) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" ( ByVal hHandle As Long , ByVal dwMilliseconds As Long ) As Long
Private Declare Function CloseHandle Lib "kernel32" ( ByVal hObject As Long ) As Long
Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = - 1&
'start the indicated program and wait for it to finish
Private Sub ShellAndWait( ByVal program_Name As String )
Dim process_id As Long
Dim process_handle As Long
process_id = Shell(program_Name, vbNormalFocus)
process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
If process_handle <> 0 Then
WaitForSingleObject process_handle, INFINITE
CloseHandle process_handle
End If
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.