473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Program already running

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
4 1699
"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
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
#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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Juho Saarikko | last post by:
The program attached to this message makes the Python interpreter segfault randomly. I have tried both Python 2.2 which came with Debian Stable, and self-compiled Python 2.3.3 (newest I could find...
6
by: Pierre-Yves | last post by:
Hello, I would like to prevent my perl program to be executed several times simultaneously (if the program is already running, I would like to display a message like "another instance of this...
22
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html ...
7
by: Joecx | last post by:
Hi Does anyone have the code or maybe give me a start on how to detect if my program is already running if someone tries to run it again while it's already running? I know I could do this with a...
4
by: Nick Sinclair | last post by:
Hi all, I'm new to C. I have successfully written a small C program that acts as a "wrapper" around cgi scripts. These scripts perform admin tasks such as backing up etc. Obviously, The need...
9
by: Scott Meddows | last post by:
How can I tell if my program is already running in memory? Code is appreciated. Thanks
2
by: Dan Tallent | last post by:
When a user launches the program, I want it to test if an update is available. You see many examples of this method to update. (Quickbooks, Norton AntiVirus, online games) I have a method...
9
by: meerubus | last post by:
Hi, Could someone advise how to go about writing a (simple?) C++ program to block a windows exe file from running? For example, my child likes to run halo.exe & the pgm can run even in a...
2
by: airprince | last post by:
I have a program in visual basic 6. Is it possible that if my program already running, even if I click my program shortcut icon, it will not run again instead it will show the one that is running...
37
by: Vince C. | last post by:
Hi all. I've installed Bloodshed Dev-C++ on a Windows 2000 SP4 machine. I'm using MinGW 3.4.2. I'd like to temporarily disable standard functions to write to stderr, i.e. for instance...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.