When my application comes up I can easily see if the other application is running with the .net Process.GetProcessesByName method
Expand|Select|Wrap|Line Numbers
- Dim MyProcesses() as Process = GetProcessesByName("AnApplication")
- For Each Instance as Process in MyProcesses
- If MsgBox("application is running - do you want to end it?", MsgBoxStyle.YesNo or MsgBoxStyle.Question, "Warning") = MsgBoxResult.Yes then
- Instance.Kill()
- Do Until Process.GetProcessByID(Instance.Id).HasExited = True
- My Application.DoEvents()
- Loop
- End if
- Next
Does anyone know of a way (other than reverting to unmanaged code) to do this properly? I'm disapointed .NET does it the way it does - it's not kosher.
Des