How can I test for previous instance of the application?

  • Thread starter Thread starter Helene Day
  • Start date Start date
H

Helene Day

I am looking for the equivalent of this VB code:

If App.PrevInstance Then

End if


Thanks,

Helene (I am still learning about .NET)
 
I got it...

Function PrevInstance() As Boolean

If
UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrent
Process.ProcessName)) > 0 Then

Return True

Else

Return False

End If

End Function
 
Helene Day said:
I got it...

Function PrevInstance() As Boolean

If
UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrent
Process.ProcessName)) > 0 Then

Return True

Else

Return False

End If

End Function

Well, that will tell you if there's another process with the same name.
It's always possible that there will be a completely *different*
process with the same name, of course. The chances of that kind of
clash happening are much lower with a named mutex, however.
 
Back
Top