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 1022535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:28:51+00:00 2026-05-16T11:28:51+00:00

I have a single-instance app (c#, WPF, .net3.51). The check if the app is

  • 0

I have a single-instance app (c#, WPF, .net3.51). The check if the app is already instantiated is done via a Mutex. If the app is already running, I open a new window from within the already opened app-instance. This works fine so far.

However due to an app extension, I now must send the e.Args (or at least the first string of it) to the already running instance which resides in another process. How is this best done?

Additional Information
Currently I use a globaly registered Window-message that I send to all open apps via PostMessage (HWND_BROADCAST). My app looks for this message and opens a new window, if this message is received. An Idea would be to set a param of PostMessage. However I found a lot of bewildering information on this topic, therefore I had not the courage to go this way. Besides of that I thought of replacing the global PostMessage-call through another activation logic, since the global call seems to have some unlovely side-effects.

  • 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. Editorial Team
    Editorial Team
    2026-05-16T11:28:52+00:00Added an answer on May 16, 2026 at 11:28 am

    You could use named pipes, which were added to the BCL in .NET 3.5.

    Create the named pipe server (argument receiver) in the already-running instance and create the named pipe client (argument sender) in the duplicate app. Then, send the arguments from the client to server.

    Either end of the named pipe can be created in C/C++ if needed. See the Win32 CreateNamedPipe function.

    Below is a simple example with the client and server both running in a single program (the “FD1AF2B4…” GUID below is just a unique identifier to avoid colliding with already-existing named pipes on the system).

    class Program
    {
        static void Main(string[] args)
        {
            Thread writerThread = new Thread(new ThreadStart(WriterThread));
            writerThread.Start();
    
            Thread readerThread = new Thread(new ThreadStart(ReaderThread));
            readerThread.Start();
        }
    
        static void ReaderThread()
        {
            NamedPipeServerStream server = new NamedPipeServerStream("FD1AF2B4-575A-46E0-8DF5-8AB368CF6645");
            server.WaitForConnection();
    
            using (var reader = new BinaryReader(server))
            {
                string arguments = reader.ReadString();
                Console.WriteLine("Received: {0}", arguments);
            }
        }
    
        static void WriterThread()
        {
            NamedPipeClientStream client = new NamedPipeClientStream("FD1AF2B4-575A-46E0-8DF5-8AB368CF6645");
            client.Connect(Timeout.Infinite);
    
            using (var writer = new BinaryWriter(client))
            {
                writer.Write("/foo /bar:33 /baz:quux");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a single-instance application and want to activate an already opened window
I have a single web app running on a single server. All users use
the WPF app I have has been redesigned to use tabs and be single
We have an issue where on a single instance of our product we receive
I have a service that I would like it to become single instance, because
I have a data storage requirement which is an excellent candidate for single instance
Is it possible to have several consumers listening on a single MSMQ instance and
I have a C# app that is launched via command line. Usually data is
I have done a WPF appliction using VS 2008 SP1 in Windows XP SP3.
I have a WPF app that updates my database from an in-code entity model.

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.