?
Solved

Ensuring only one process is running at once

Posted on 2006-06-05
2
Medium Priority
?
273 Views
Last Modified: 2010-04-16
Hi,

I need to ensure only one instance of my application is running at once. But i *must* know when another instance tried to start and the cmd line params it was called with.

In Objective-C this is called a Document application, but I can't seem to find anything like this in .Net. I know it exists, I've seen plenty of applications use it.
0
Comment
Question by:salted
2 Comments
 
LVL 28

Accepted Solution

by:
2266180 earned 2000 total points
ID: 16832931
Hi,

you will have to use mutex'es. one way or another. here is an example:
http://www.codeproject.com/csharp/singleinstance.asp

so basically, you define your mutex, when you fire up you check if the mutex is defined: if it is, it means you're running already. so you can pass the command line arguments to the already running application (using windows messages for example) and then show the running app. shouldn't be too hard to modify the example code from teh above link.
0
 

Author Comment

by:salted
ID: 16833148
Excellent! Thanks :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question