Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Private Function SingleInstance() As Boolean
  2. Dim m_Mutex As System.Threading.Mutex
  3. Dim m_UniqueIdentifier As String = Application.ExecutablePath.Replace("", "_")
  4.  
  5. m_Mutex = New System.Threading.Mutex(True, m_UniqueIdentifier)
  6.  
  7. 'This is the first instance
  8. If m_Mutex.WaitOne(1, True) Then
  9. Return True
  10. Else
  11. ' Not the first instance!!!
  12. m_Mutex = Nothing
  13. Return False
  14. End If
  15.  
  16. End Function
Add Comment
Please, Sign In to add comment