Link to home
Start Free TrialLog in
Avatar of heartland
heartland

asked on

Launch a window application and wait for complete

Hi Expert,

Following code works fine if I want to launch an application program:

Sub LaunchApplication()
    Dim iAppID As Integer = Shell(appPath, AppWinStyle.MaximizedFocus)
    If System.IO.File.Exists(appPath) = True Then
        AppActivate(iAppID)
    Endif
End Sub

However, If I want to launch an application and force the operation system to wait until the application has been terminated before allowing any other action to be performed.  How do I do?  I  heard of ExecuteAndWait method. How does that work?  The code will be in form_load event.

Thanks very much

heartland
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Hi heartland,

It is WaitForExit. See an article I wrote in December 2003 from http://emoreau.s2i.com/


Cheers!
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
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 heartland
heartland

ASKER

Hi Fernando,

I tried your code and it did the exactly what I wanted.  It is concise too.  Thanks for help.

Hugh
Glad I was able to help. :=)