I have a class that runs an external ap using shell then waits till the app is quit before carrying on.

Does anybody know if it is possible to start an app say by clicking a button then be told when the app has closed. The app can be open more than once.

The problem I have is when the code is run everything stops till the app has finished.

Hope this makes sense.

Here is the code I have so far:

Public Function StartAndWait(ByVal ProcessPath As String, ByVal Licence As Integer)
        Dim startProcess As System.Diagnostics.Process
            startProcess = New System.Diagnostics.Process()
            startProcess.StartInfo.FileName = ProcessPath
            startProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal

            'Wait until the process passes back an exit code 

            ' Check Exit code to see if process finished without error.
            If startProcess.ExitCode <> 0 Then
                MessageBox.Show("Exit Code: " & startProcess.ExitCode)
            End If

            'Free resources associated with this process

            StartAndWait = True

            StartAndWait = False
            MessageBox.Show("Could not start process " & ProcessPath, "Error")
        End Try
    End Function

I would try using Multi-Threading

Make the main thread continue running your application and the NEW Multi-Thread the open the other application

when the application is running the new thread will pause but your main app will continue to run also when the external app is closed the new thread will continue (add a msgbox in the new thread) and then the thread will close


Thanks for your reply. I will give it a go on Monday (work). I'm new to VB.NEt. In the process of moving from VB6.

The link you added looks great as well.