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

determine if application is already running

Hi,

is there a simple way in .Net to determine if there is already an instance
running of an application ? I want to avoid that a user starts an application
twice.

Thanks,

Koert
Nov 22 '05 #1
4 3621
Might be something in the system.diagnostics namespace that can do what you
want...

"Koert" <Ko***@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com...
Hi,

is there a simple way in .Net to determine if there is already an instance
running of an application ? I want to avoid that a user starts an application twice.

Thanks,

Koert

Nov 22 '05 #2
Hi Koert,

Use named mutex.
http://www.yoda.arachsys.com/csharp/...ation.instance

HTH,
Rakesh Rajan

"Koert" wrote:
Hi,

is there a simple way in .Net to determine if there is already an instance
running of an application ? I want to avoid that a user starts an application
twice.

Thanks,

Koert

Nov 22 '05 #3
Take a look at the singleton design pattern.

theory of the singleton design pattern:
http://msdn.microsoft.com/library/de...tondespatt.asp
in VB.NET:
http://www.abstractvb.com/code.asp?A=1096
in C#:
http://www.c-sharpcorner.com/Code/20...tonPattern.asp
http://www.codeproject.com/csharp/de...erns_in_c_.asp

hope that helps..
Imran.

"Koert" <Ko***@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com...
Hi,

is there a simple way in .Net to determine if there is already an instance
running of an application ? I want to avoid that a user starts an application twice.

Thanks,

Koert

Nov 22 '05 #4
Imran Koradia <no****@microsoft.com> wrote:
Take a look at the singleton design pattern.
That won't help at all, as the singleton would be local to the process.
theory of the singleton design pattern:
http://msdn.microsoft.com/library/de...tondespatt.asp
in VB.NET:
http://www.abstractvb.com/code.asp?A=1096
That uses a heavyweight mutex for no good reason. SyncLock is a better
approach.
in C#:
http://www.c-sharpcorner.com/Code/20...tonPattern.asp
That implementation isn't threadsafe at all.
http://www.codeproject.com/csharp/de...erns_in_c_.asp


That one is (in the same way as the MS one) but doesn't point out the
simpler patterns available.

See http://www.pobox.com/~skeet/csharp/singleton.html for my take on
singletons.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mark Fisher | last post by:
I have a Java desktop GUI application that the user can run multiple times. In order to keep one instance of the application distinct from another, I'd like to put the instance number of the...
5
by: Mike | last post by:
Does python support named semaphores for Linux? I saw that ActivePython for Win32 does. Can I get a list of currently running processes? I already posted in the GTK forum about looking for the...
4
by: Koert | last post by:
Hi, is there a simple way in .Net to determine if there is already an instance running of an application ? I want to avoid that a user starts an application twice. Thanks, Koert
7
by: Ross Presser | last post by:
OK, I've been researching this problem and can't find a definitive answer yet. The situation is one that seems to have come up a few times to different folks. I am writing an application that...
0
by: Tomas | last post by:
I have two questions: (1) How (if possible) can you, with ASP.NET (and with the IIS 5 included with win2000) specify an maximum limit of the memory that a web application may consume, as an...
22
by: Nina | last post by:
While user is working on a windows application, at same time he or she launches another instance of the same application. Will this affect the global variables in the first instance of this...
11
by: CJM | last post by:
I need to be able to determine if the user is a member of a given AD group. I have a method of doing this, but it is not suitable for 64bit OS's, so I need to find an alternative route. I actually...
7
by: semedao | last post by:
Hi all, I view many posts about this issue , the connected property does not tell us the current status of the socket. based on couple of suggestions of msdn , and some article here , I try to...
2
by: pamela fluente | last post by:
I have an application running. A file type is registered with this application. When the user click on a file of such type a new instance of the application is loaded with command line (file name)....
19
by: =?Utf-8?B?R3JlZw==?= | last post by:
How can I tell via code if a Form is already open. Each time my forms load I have some initialization code that runs, but if the form is already open and hidden I don't want that initialization...
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...
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.