How to enforce only 1 instance can be running at the same time?

  • Thread starter Thread starter babylon
  • Start date Start date
B

babylon

e.g. we can only start one instance of Outlook Express (vs multiple instance
of IE)
How should this be implmented in winform?

thx
 
I run my app from a sub main and this is how I was shown to do it.

Imports System.Threading

Private m As Mutex
Sub Main()
Dim first As Boolean
m = New Mutex(True, "Your App Name Here", first)
If Not (first) Then
MessageBox.Show("The Application is already running.")
AppRunning()
Exit Sub
End If


Private Sub AppRunning()
Application.Exit()
End Sub
 
System wide meaning on a single computer... Yes. Network wide of web
wide... I don't think so.
 
Back
Top