Sign in to follow this  

[.net] Easiest way to send messages to another application.

This topic is 4093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have a two programs written in C#. (App1.exe and App2.exe) when you click a button in one application it opens another application with a command line parameter..I do that like this
void button_handler_for_App1.exe(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("C:\App2.exe Param1");
}
when this statement is run, the second application opens up (App2.exe), and it executes a function depending on the command line parameter (Param1). Where my question comes in, is...if App2.exe is already I opened...I would just like it to execute a function...I don't want to have App1.exe open another instance of App2.exe. Sort of how microsoft word works. If you click on a word document, and MS Word is already opened...it doesn't open another copy of MS Word..it simply opens it in the already opened MS Word. How does one do this? I have no problem being able to tell if App2.exe is open (I would just do a process search)...the part i'm stuck on is how do I tell App2.exe from App1.exe to do something? (that is without sockets....or is that my only choice?) Thanks, ArchG

Share this post


Link to post
Share on other sites
Look in the MSDN for IpcClientChannel and IpcServerChannel, I think they will be what you're looking for. Both Apps would have a client and server. When App1 attempts to connect to App2's server, a failure indicates App2 doesn't exist, so App1 should launch App2 and wait for App2 to connect to App1's server.

Skizz

Share this post


Link to post
Share on other sites
What you likely want to look up is how to make a single instance application.

Here is the example that I used in my application to achieve that Microsoft Word like functionality.

http://www.codetools.com/csharp/CSSIApp.asp

Share this post


Link to post
Share on other sites

This topic is 4093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this