Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 144211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:13:03+00:00 2026-05-11T08:13:03+00:00

In .NET, what is the most reliable way to detect if an instance of

  • 0

In .NET, what is the most reliable way to detect if an instance of the same program is already running? Further, what is the best way to pass command line arguments to the already-running instance (e.g. to open a specific document)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:13:04+00:00Added an answer on May 11, 2026 at 8:13 am

    There appears to be three well-known ways of implementing single-instance applications in .NET programs: the process method, the Mutex method, and the Visual Basic method.

    Michael Covington discusses the first two in his hint, Ensuring that only a single instance of a .NET application is running.

    There’s a CodeProject article that discusses the Mutex method in more detail, including getting the window handle of the existing application so that you can then (somehow) communicate with it.

    Another CodeProject article describes how to use classes in the Microsoft.VisualBasic namespace (which is accessible from C#) to implement a single-instance application.

    I’m not at all familiar with the third method. Of the first two, they both work but as is pointed out in the linked articles, the Mutex method seems more robust. I don’t know why Mutex was selected as the named object to use. Any of the named synchronization objects (EventWaitHandle, Mutex, Semaphore, etc.) would work.

    Communicating with the existing application presents more of a problem. I’d suggest you look into using named pipes, if all you need to do is send a relatively small message to the running application. Check out System.IO.Pipes.NamedPipeClientStream for more information.

    I should also note that if you’re worried about security, you’ll need to secure whatever communications method you use. Any application that has sufficient permissions will be able to send information to your running application through the named pipe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

C# / .net framework What is the most reliable way to determine whether a
How do most people handle updating ASP.NET applications running in a webfarm? I am
What is the most reliable way to get the path of My Pictures as
I'm looking for the most reliable way to use both Windows and Form based
What is the cleanest, most ASP.NET MVC3 way, for lack of a better term,
I am planning on re-writing a Win32 application (native C++) in .NET - most
So like most new .NET developers you start of passing DataSets everywhere and although
Most ASP.NET hosts give you a single website in IIS. Then, they let you
What is the most mature .NET MPI implementation? A quick google search turned up
What is the most appropriate .Net exception type for when you have a class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.