Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Function SingleInstance() As Boolean
- Dim m_Mutex As System.Threading.Mutex
- Dim m_UniqueIdentifier As String = Application.ExecutablePath.Replace("", "_")
- m_Mutex = New System.Threading.Mutex(True, m_UniqueIdentifier)
- 'This is the first instance
- If m_Mutex.WaitOne(1, True) Then
- Return True
- Else
- ' Not the first instance!!!
- m_Mutex = Nothing
- Return False
- End If
- End Function
Add Comment
Please, Sign In to add comment