Send message from ProcA to ProcB

  • Thread starter Thread starter Augie
  • Start date Start date
A

Augie

Hi all.

How do you send a message from one App to another (say ProcA to ProcB)?

TIA

Augie
 
Augie said:
How do you send a message from one App to another (say ProcA to ProcB)?

A comprehensive answer depends on the context.

Until you provide more information you can consider:

1) Windows' messages, e.g. WM_COPYDATA
2) Even though Dynamic Data Exchange (DDE) is sometimes called D-DEad it
still works :-)
3) COM
4) D-COM
5) mailslots
6) shared memory
7) sockets
8) pipes

Regards,
Will
 
Thanks for the reply.

I have looked at those docs...

Can you use WM_COPYDATA with .NET?

Does .NET offer something better?

If you can use WM_COPYDATA, then how do implement this?

How do you find a ProcA using VC++ .NET to pass to SendMessage?

How do I implement the message loop in a .NET app (ProcB) to look at the
WM_COPYDATA message?

Are there any specific sample out there on how to do this?

TIA

Augie
 
Augie said:
Thanks for the reply.

You are welcome.
Can you use WM_COPYDATA with .NET?

Well, yes. There is something called Platform/Invoke (aka P/Invoke) which
allows managed code to call unmanaged functions. Using it is one way a .Net
application can send an ordinary message to an arbitrary window. Basically
you would P/Invoke FindWindow() and SendMessage().
Does .NET offer something better?

Well, yes. A decade and a half ago, Windows messages were just about the
only IPC techinque available on Windows. These days there are other, better
options. I tried to offer some suggestions in my last post to you.
If you can use WM_COPYDATA, then how do implement this?

You use FindWindow() to locate a window and SendMessage() to pass it some
data.
How do you find a ProcA using VC++ .NET to pass to SendMessage?

Processes are not "sinks". Windows are, sockets are, pipes are, mail slots
are, yada yada yada. :-)
How do I implement the message loop in a .NET app (ProcB) to look at the
WM_COPYDATA message?

It is not something that I have tried but it _may_ be that it is with
preProcessMessage().
Are there any specific sample out there on how to do this?

Can I ask what you are sending? How much? How often? Perhaps someone will be
able to point you to a sample.

Regards,
Will
 
Thanks again.

I'm using WM_COPYDATA.

I have setup the FindWindow and SendMessage code.

Now I'm having trouble finding the necessary info to setup a handler for
this message in a Windows Form VC++ .NET app. How is this done? The Form
Class has no predefined event for this message... does it? How do I do
this?

TIA

Augie
 
Back
Top