If you make a public function similar to this
Public Shared Function PrevInstance() As Process
Dim c As Process = Process.GetCurrentProcess()
Dim p As Process
For Each p In Process.GetProcessesByName(c.ProcessName)
If p.Id <> c.Id Then
If p.MainModule.FileName = c.MainModule.FileName Then
Return p
End If
End If
Next p
Return Nothing
End Function
And then call it from say the Form load event or a sub main
If Not PrevInstance() Is Nothing Then
MsgBox("Myapp is already running !", MsgBoxStyle.Information, "Myapp")
End
' Else
' Exit.
End If
Hope this helps...
meh
"Michael Passalacqua" <mpassala@pcc.edu> wrote in message news:e1CqniOmDHA.424@TK2MSFTNGP10.phx.gbl...[color=blue]
> In VB.NET, how do you check to see if an instance of your application is
> already running?
>
> Michael Passalacqua
> Portland Community College
> CIS Faculty
>
> *** Sent via Developersdex
http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]