I use my primary Visual Basic (Visual Studio 2010) application as the UI to kick off other secondary VB applications.
I want to monitor which secondary apps are currently open, and then if a user tries to kick off an app that is already open, then I'll kill the first instance before starting the new one.
The problem is that the process that kicks off the secondary app always shows hasexited=True even though the actual app is still running. I've tried using "setup.exe," "TestApp," and "TestApp.application."
Private ProcList As New List(Of Process)(5)
Private Sub kickoff(ByVal sender As System.Object, ByVal e As System.EventArgs)
'app = "MyApp.application"
'app = "MyApp"
app = "setup.exe"
For Each x In ProcList
If x.StartInfo.FileName Like MyPath & "\" & app Then
If Not x.HasExited Then x.Kill()
ProcList.Add(Process.Start(MyPath & "\" & app))