Private Function PrevInstance() As Boolean
If
UBound(System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Proc
ess.GetCurrentProcess.ProcessName)) > 0 Then
Return True
Else
Return False
End If
End Function
#End Region
Usage:
--------
If PrevInstance() = True Then
MessageBox.Show("Application is already running")
End ' Must call end & not 'Application.Exit()' here
End If
Private Function PrevInstance() As Boolean
If
UBound(System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Proc
ess.GetCurrentProcess.ProcessName)) > 0 Then
Note that process names are not necessarily unique.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.