Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

Send message from ProcA to ProcB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Augie - 04 May 2004 20:06 GMT
Hi all.

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

TIA

Augie
William DePalo [MVP VC++] - 04 May 2004 20:28 GMT
> 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
Augie - 04 May 2004 20:52 GMT
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
> > How do you send a message from one App to another (say ProcA to ProcB)?
>
[quoted text clipped - 14 lines]
> Regards,
> Will
William DePalo [MVP VC++] - 05 May 2004 20:38 GMT
> 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
Augie - 06 May 2004 16:32 GMT
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

> > Thanks for the reply.
>
[quoted text clipped - 36 lines]
> Regards,
> Will

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.