Problem running multiple external apps
Hi,
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
Try
startProcess = New System.Diagnostics.Process()
startProcess.StartInfo.FileName = ProcessPath
startProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
startProcess.Start()
'Wait until the process passes back an exit code
startProcess.WaitForExit()
' 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
startProcess.Close()
StartAndWait = True
Catch
StartAndWait = False
MessageBox.Show("Could not start process " & ProcessPath, "Error")
End Try
End Function
purplegerbil
Junior Poster in Training
78 posts since Apr 2005
Reputation Points: 24
Solved Threads: 6
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.
Cheers,
PG
purplegerbil
Junior Poster in Training
78 posts since Apr 2005
Reputation Points: 24
Solved Threads: 6