How to detect if a other process of my program is running?

Visual Basic:
Dim mut As New Mutex(False, "Name of your app as it is on the title bar")
If Not mut.WaitOne(0, false) Then
  'your app is running already
End if
This should help you :)
 
Do i need to define "Mutex"?
VB says:Type Mutext not defined??
Btw what if i don't have a form yet?
 
You can find Mutex in the Threading namespace.
If you dont have a form just specify the name of your application as a whole, not the form. Like "WindowsApplication2".
 
Dim mut As New Threading.Mutex(False, "apachemon")
If Not mut.WaitOne(0, False) Then
MsgBox("ApacheMon is running")
End If
Will do nothing?
apachemon <- is my exe and application name.
 
Found it :D
Needs to be the full exe name -> apachemon.exe as show in the taskmanager when looking at proccesses
 
hmmz,
Strage, it work, i recompiled it in release and it won't run anymore :( and if i compile it as debug -> the same :confused:
 
Last edited:
Back
Top