?
Solved

Launch a window application and wait for complete

Posted on 2006-03-23
4
Medium Priority
?
203 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:heartland
  • 2
4 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 16273712
Hi heartland,

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


Cheers!
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 16273827
Hi heartland;

The below code should do what you want.

Imports System.Diagnostics

Sub LaunchApplication()
    If System.IO.File.Exists(appPath) = True Then
        Dim p As Process
        p = Process.Start(appPath)
        p.WaitForExit()
End Sub

Fernando
0
 

Author Comment

by:heartland
ID: 16274288
Hi Fernando,

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

Hugh
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16274333
Glad I was able to help. :=)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month14 days, 23 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question