Ensuring only one process is running at once

Posted on 2006-06-05
Last Modified: 2010-04-16

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.
Question by:salted
    LVL 28

    Accepted Solution


    you will have to use mutex'es. one way or another. here is an example:

    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.

    Author Comment

    Excellent! Thanks :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now