Hi:
I am using single instance control, and I need to be more specific about what I'm closing. Sometimes, my application hangs...and the new instance launching thinks that it shouldn't run since it sees a process by the same name is already running. I can get around this by using the following:
Proc = Process.GetProcessesByName("MyApp")
For Each Prc As Process In Proc
Hdl = Prc.MainWindowHandle
'a value of zero means there is no visible gui
If Hdl.Equals(System.IntPtr.Zero) Then
Prc.Kill()
End If
Next
However, I will kill my application in the process...is there a way to get the process id for the instance I am trying to launch?
Eric
I am using single instance control, and I need to be more specific about what I'm closing. Sometimes, my application hangs...and the new instance launching thinks that it shouldn't run since it sees a process by the same name is already running. I can get around this by using the following:
Proc = Process.GetProcessesByName("MyApp")
For Each Prc As Process In Proc
Hdl = Prc.MainWindowHandle
'a value of zero means there is no visible gui
If Hdl.Equals(System.IntPtr.Zero) Then
Prc.Kill()
End If
Next
However, I will kill my application in the process...is there a way to get the process id for the instance I am trying to launch?
Eric