Program 1 opens, triggers an event in program 2

  • Thread starter Thread starter Patrick B
  • Start date Start date
P

Patrick B

When application #1 opens, I would like it to trigger an event in
application #2.

How do you send a message from one window to another? How can
application #1 look to see if application #2 is open, and if it is,
notify application #2 that it has started?

I know that using the win32 api there's a way to send messages between
windows, but I don't know how that translates into .NET.

I posted a similar question in the past and received a suggestion about
remoting. I've looked into remoting and I wonder if there's not a more
straightforward way.

Thanks!

Patrick
 
You could use P/Invoke to get the Win32 API calls that would allow you
to create a custom windows message and then find the handle of the
window that you want to communicate with and then pass the message;
while the target window overrides Control.PreProcessMessage in order to
intercept the custom message.

However, by the time that you have done all of that, you really don't
have something that is more straightforward than Remoting, which is
really quite simple to use and understand once you take the plunge and
just write a little code to try it out.

If you really want to go the windows messages route, here's a link that
ought to start you in the right direction:
http://tinyurl.com/3tsmj

Regards,

Adam
 
Back
Top