Link to home
Start Free TrialLog in
Avatar of meperera
meperera

asked on

Visual Basic 6.0 ShellAndWait - How do I still keep the user interface active ?

Hi  Experts,
I have a program where I use the a ShellanWait function to run a few external programs. However, when I call the external program the main Windows looks frozen (I know it's not frozen but that 's how the users of the program will see that)

I want to leave the main Window active so I can show the users something like a "Please Wait" bar.

Any help would be greatly appreciated.
 
The following is my syntax,




Public Sub ShellAndWait(ByVal program_name As String, _
    ByVal window_style As VbAppWinStyle)
    On Error Resume Next
Dim process_id As Long
Dim process_handle As Long  
   
    process_id = Shell(program_name & " " & "/s", window_style)    

 
    process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
    If process_handle <> 0 Then
        WaitForSingleObject process_handle, INFINITE
        CloseHandle process_handle
    End If

End Sub
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of meperera
meperera

ASKER

Thanks Idle_Mind. That did the trick.