473,385 Members | 1,829 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,385 software developers and data experts.

Is my program already running?

How can I tell if my program is already running in memory? Code is
appreciated.

Thanks
Nov 20 '05 #1
9 1603
Check you System.Diagnostics.Processes collection to see if a process with
the same name is running

-CJ
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
How can I tell if my program is already running in memory? Code is
appreciated.

Thanks

Nov 20 '05 #2
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
How can I tell if my program is already running in memory? Code is
appreciated.


'Check to see if a previous instance of this application is running already
If
(UBound(Diagnostics.Process.GetProcessesByName(Dia gnostics.Process.GetCurren
tProcess.ProcessName)) > 0) Then
MessageBox.Show("Already running a copy of this program on your
system.", , MessageBoxButtons.OK, MessageBoxIcon.Information)
Return False
Exit Function
End If
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
Nov 20 '05 #3
Thanks. EXACTLY what I needed!

"George Shubin" <dx@dxonline.com> wrote in message
news:OM*************@tk2msftngp13.phx.gbl...
"Scott Meddows" <sc******************@tsged-removeme.com> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
How can I tell if my program is already running in memory? Code is
appreciated.
'Check to see if a previous instance of this application is running

already If
(UBound(Diagnostics.Process.GetProcessesByName(Dia gnostics.Process.GetCurren tProcess.ProcessName)) > 0) Then
MessageBox.Show("Already running a copy of this program on your
system.", , MessageBoxButtons.OK, MessageBoxIcon.Information)
Return False
Exit Function
End If
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

Nov 20 '05 #4
* "Scott Meddows" <sc******************@tsged-removeme.com> scripsit:
Thanks. EXACTLY what I needed!


But won't work if there are 2 or more apps with the same name (but
different apps) running on the machine. I know, that's a rare case, but
it can happen for simple app names like "Calc" or something like that.

For alternatives, see other replies.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
* "Scott Meddows" <sc******************@tsged-removeme.com> scripsit:
How can I tell if my program is already running in memory? Code is
appreciated.


<http://groups.google.com/groups?selm=%23sOlWLPmDHA.1072%40TK2MSFTNGP09.phx. gbl>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
* "Scott Meddows" <sc******************@tsged-removeme.com>
scripsit:
Thanks. EXACTLY what I needed!


But won't work if there are 2 or more apps with the same name (but
different apps) running on the machine. I know, that's a rare case,
but it can happen for simple app names like "Calc" or something like
that.


But you can start calc twice!
;->
--
Armin

Nov 20 '05 #7
* "Armin Zingler" <az*******@freenet.de> scripsit:
But won't work if there are 2 or more apps with the same name (but
different apps) running on the machine. I know, that's a rare case,
but it can happen for simple app names like "Calc" or something like
that.


But you can start calc twice!
;->


But my own "Calc" replacement only allows one instance and it should
still run if Windows' Calc is running.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
*Slaps Herfried in Head*

Was it really "necessary" to write your own Calc app? Cmon now. =)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e6**************@TK2MSFTNGP10.phx.gbl...
* "Armin Zingler" <az*******@freenet.de> scripsit:
But won't work if there are 2 or more apps with the same name (but
different apps) running on the machine. I know, that's a rare case,
but it can happen for simple app names like "Calc" or something like
that.


But you can start calc twice!
;->


But my own "Calc" replacement only allows one instance and it should
still run if Windows' Calc is running.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #9
* "CJ Taylor" <no****@blowgoats.com> scripsit:
*Slaps Herfried in Head*

Was it really "necessary" to write your own Calc app? Cmon now. =)


;->

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10

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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.