By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,032 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,032 IT Pros & Developers. It's quick & easy.

Program already running

P: n/a
How would one check to see if a program is already running? I don't want my
app to be launched more than once.

Thanks,
Mark
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Mark" <Ma**@discussions.microsoft.com> schrieb:
How would one check to see if a program is already running? I don't want
my
app to be launched more than once.


How do I make sure that only one instance of my application runs at a time?
<URL:http://www.yoda.arachsys.com/csharp/faq/#one.application.instance>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
On Wed, 23 Mar 2005 10:29:03 -0800, "Mark" <Ma**@discussions.microsoft.com> wrote:

How would one check to see if a program is already running? I don't want my
app to be launched more than once.

See if the following helps:

http://www.knowdotnet.com/articles/previnstance.html
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 21 '05 #3

P: n/a
#Region "Previous Existance (FUNCTION)"

Private Function PrevInstance() As Boolean
If
UBound(System.Diagnostics.Process.GetProcessesByNa me(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
Nov 21 '05 #4

P: n/a
"Crouchie1998" <cr**********@discussions.microsoft.com> schrieb:
Private Function PrevInstance() As Boolean
If
UBound(System.Diagnostics.Process.GetProcessesByNa me(System.Diagnostics.Proc
ess.GetCurrentProcess.ProcessName)) > 0 Then


Note that process names are not necessarily unique.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.