[Source] Single instance app code 03-25-2011, 11:04 PM
#1
Hi,
well, this isn't my creation, it is from web called: www.vbnet.cz
to find the whole thread click HERE (Note: The Language is Czech)
Okay, so, not much to tell about it... by using mutex, this will detect, if your application is already running or not. Simple as that
well, this isn't my creation, it is from web called: www.vbnet.cz
to find the whole thread click HERE (Note: The Language is Czech)
Okay, so, not much to tell about it... by using mutex, this will detect, if your application is already running or not. Simple as that

Code:
Private appMutex As System.Threading.Mutex
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Form1.Load
Dim createdNew As Boolean
appMutex = New System.Threading.Mutex(False, "Unique mutex name", createdNew)
If Not createdNew Then
MessageBox.Show("Application is already running.", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Application.Exit()
End If
End SubStaff will never ever ask you for your personal information.
We know everything about you anyway.
We know everything about you anyway.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)

![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)