Discussion:
Communicating between apps
(too old to reply)
John
2009-04-02 14:48:30 UTC
Permalink
Hi

I need to send a string from one dotnet app to another from time to time. As
it is a light weight use I am wondering if there is a light weight way such
as using windows messaging to send this string without having to resort to
remoting etc. I would appreciate any ideas on how to carry this out. A code
example would be great.

Many Thanks

Regards
j***@live.com
2009-04-02 15:14:05 UTC
Permalink
Post by John
Hi
I need to send a string from one dotnet app to another from time to time. As
it is a light weight use I am wondering if there is a light weight way such
as using windows messaging to send this string without having to resort to
remoting etc. I would appreciate any ideas on how to carry this out. A code
example would be great.
I did this years ago in the UNIX world, but I haven't tried it yet
in .NET.

If the second app is a Console application that is created by the
first app, you can communicate with a couple of streams attached to
the Console app's Standard Input and Standard Output. If you have two
windows apps that were launched independantly, you should be ablt to
communitcate via a couple of named pipes.
Tom Shelton
2009-04-02 15:47:14 UTC
Permalink
Post by John
Hi
I need to send a string from one dotnet app to another from time to time. As
it is a light weight use I am wondering if there is a light weight way such
as using windows messaging to send this string without having to resort to
remoting etc. I would appreciate any ideas on how to carry this out. A code
example would be great.
Many Thanks
Regards
If the apps are on the same machine, then you can do this using SendMessage
with WM_COPYDATA. Of course you have to be able to get the hwnd of the other
app, etc.
--
Tom Shelton
Jesse Houwing
2009-04-02 19:56:14 UTC
Permalink
Hello Tom,
Post by Tom Shelton
Post by John
Hi
I need to send a string from one dotnet app to another from time to
time. As it is a light weight use I am wondering if there is a light
weight way such as using windows messaging to send this string
without having to resort to remoting etc. I would appreciate any
ideas on how to carry this out. A code example would be great.
Many Thanks
Regards
If the apps are on the same machine, then you can do this using
SendMessage with WM_COPYDATA. Of course you have to be able to get
the hwnd of the other app, etc.
This will be barred if you're runnign Vista if I understood correctly. The
safest way to do this is using named pipes. And an easy way to have real
object based communication is to use WCF to communicate between these applications
(can be configured to either use named pipes or tcp).
--
Jesse Houwing
jesse.houwing at sogeti.nl
Tom Shelton
2009-04-02 20:31:02 UTC
Permalink
Post by Jesse Houwing
Hello Tom,
Post by Tom Shelton
Post by John
Hi
I need to send a string from one dotnet app to another from time to
time. As it is a light weight use I am wondering if there is a light
weight way such as using windows messaging to send this string
without having to resort to remoting etc. I would appreciate any
ideas on how to carry this out. A code example would be great.
Many Thanks
Regards
If the apps are on the same machine, then you can do this using
SendMessage with WM_COPYDATA. Of course you have to be able to get
the hwnd of the other app, etc.
This will be barred if you're runnign Vista if I understood correctly. The
safest way to do this is using named pipes. And an easy way to have real
object based communication is to use WCF to communicate between these applications
(can be configured to either use named pipes or tcp).
--
Jesse Houwing
jesse.houwing at sogeti.nl
Nothing wrong with named pipes :) Especially as they are supported no in the
runtime. But, he asked about the possibility of using windows messaging, so I
thought of WM_COPYDATA...

There are some limitations with WM_COPYDATA under vista, but I thought it had
to do with drivers and services - rather then desktop applications. I could
be wrong, I haven't used this technique for a while - long enough that I
haven't tried it on Vista :)
--
Tom Shelton
Loading...