473,699 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check if instance of exe is running already

What is the C# command/function for checking to see if another instance of
the application is already running?
Mar 20 '07 #1
4 6496
On Tue, 20 Mar 2007 11:45:05 -0700, Rob wrote:
What is the C# command/function for checking to see if another instance of
the application is already running?
Read this link for ideas

http://www.codeproject.com/csharp/re..._instances.asp

--
Bits.Bytes
http://bytes.thinkersroom.com
Mar 20 '07 #2
Rob,

I assume you are looking to only have one instance of your app running
at the same time. In order to do this, check out a previous response to
this question:

http://groups.google.com/group/micro...128f9ddd957ada

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Rob" <Ro*@discussion s.microsoft.com wrote in message
news:B5******** *************** ***********@mic rosoft.com...
What is the C# command/function for checking to see if another instance of
the application is already running?

Mar 20 '07 #3
Rob <Ro*@discussion s.microsoft.com wrote:
What is the C# command/function for checking to see if another instance of
the application is already running?
See http://pobox.com/~skeet/csharp/faq/#...ation.instance

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 20 '07 #4
"Rob" <Ro*@discussion s.microsoft.com wrote in message
news:B5******** *************** ***********@mic rosoft.com...
What is the C# command/function for checking to see if another instance of
the application is already running?

Use a mutex like this:

...
bool firstInstance;
using (Mutex AppMutex = new Mutex(true, new
Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"). ToString(), out firstInstance))
{
if (firstInstance= = true)
{
// run your code from here
}
} // mutex released here.
...
Willy.

Mar 20 '07 #5

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

Similar topics

3
3428
by: Roger | last post by:
How can I check if a field already exist in a table? If it doesn't exist I want to add it with ALTER TABLE ADD...
3
1574
by: Deasun | last post by:
Good morning In vb.net how would one go about checking if the app is already running Need some pointers on this Thank Deasun
3
4589
by: Mike Thomas | last post by:
In Access 2000, Win NT, Citrix, we have each user opening the front end mdb in their own folder, and linnking to the back end. I've noticed that a user can get more than one instance open at a time if they are not careful. Is there a way to have an instance of Access check to see whether there is another one already open for this user, and if so, simply to maximize the window of the already running instance? Thanks Mike Thomas
2
2579
by: maccaroo | last post by:
Hello, Is it possible to find out if the current code if executing in the full version of Access or if it is using a runtime? We have a number of roaming users running a mixture of versions, but using the same program. I need to implement features such as spell-checks, but don't want to confuse the runtime users with options they cannot use. Is there some sort of check that can determine this? Thanks
9
41655
by: KelsMckin | last post by:
Hello, I was wondering if there was a way to check there was already a form open before opening a new one, sorry that doesnt seem clear, here is an example: The following button opens a new form private void btnAbout_Click(object sender, EventArgs e) { avernusAbout About = new avernusAbout(); About.StartPosition = FormStartPosition.Manual;
3
11044
by: byeung | last post by:
Hi, I am trying to check if a particular record already exists in an Access database through Excel vba code. Through code obtained at another forum, I got the following: *********************************************************************** Sub TheButton()
4
10191
by: Simon Gare | last post by:
Hi all, below is an insert statement on an asp page that stores the date and time that a driver logged on, what I need is to check that they are now already logged on fields are SQL Server 2000 ID int DRIVER_NO int
3
2514
by: Rudi | last post by:
Hello, following problem: At program end or release an assembly a serial device should get a final exit sequence. How can I do this? With Dispose() it's no problem, but this assembly is used in a com interop dll and it must be guaranteed, that the final sequence is send to the serial device, when the calling application dont send Close() or Dispose().
5
5991
by: ashurack | last post by:
I found a stored procedure online a while back and want to inplement it. The only problem is that it doesn't check to see if the number generated is currently in use in the DB. I know it's really unlikely for the same number to be generated twice (with a 10 digit number) but it's for a shopping cart so I need it to be 100% reliable. I thought about opening a cursor then looping through each distinct record in the DB but couldn't figure...
0
8687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8617
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9174
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7751
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.