Its better if I describe this using code. I have the following interface:
public interface IMyInterface
{
void DoSomething();
}
I have two Windows Form applications, called MyFirstApp and MySecondApp. Both applications implement the IMyInterface interface. MyFirstApp is calling MySecondApp like so:
var p = Process.Start("MySecondApp");
Everything if working as expected. Now what I want to do is, after MySecondApp launches, I'd like to be able to figure out how it was started (in this case, it was started by MyFirstApp) and if it was started my MyFirstApp, I'd like to be able to get a reference to the interface and call DoSomething() inside MyFirstApp. So the psuedo-code for MySecondApp will look like this:
if (this was started by MyFirstApp)
{
IMyInterface firstApp = (IMyInterface)<handle to MyFirstApp>;
firstApp.DoSomething();
}
My question is, how do I do this in C#?