Jump to content
  • Advertisement
Sign in to follow this  
ArchG

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

This topic is 4287 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!