By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,081 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,081 IT Pros & Developers. It's quick & easy.

C#.exe "talks" to C++.exe

P: n/a
Hello All,
Thanks for your help first, I wonder is there any link to sample or
documentation that explain how to make .exe in C++ communicate to .exe in C#?
I know there is some way like Share Memory, COM but I really need a
place that I could get jump start
Thanks
Have a wonderful day

Anthony
Dec 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Anthony wrote:
Hello All,
Thanks for your help first, I wonder is there any link to sample or
documentation that explain how to make .exe in C++ communicate to
.exe in C#? I know there is some way like Share Memory, COM but I
really need a
place that I could get jump start


By C++ exe I assume you mean unmanaged code. If the unmanaged process is
a COM local server then it's easy, you just use tlbimp to create the
import assembly and use it in the .NET application. Of course if the
native process is not a COM server and you are not a COM developer it
might not be straightforward for you to add that functionality to your
unmanaged process.

Shared memory is another option, but there is no .NET API to do that. If
you want a clue then I recommend that you use Reflector and take a look
at how .NET handles performance monitor counters (for example, take a
look at the private type System.Diagnostics.SharedPerformanceCounter).
Note that if you have memory shared between processes then you need to
control access to it using some locking mehanism accessible to both
processes, like a couple of named events, or a named mutex.

The simplest solution is to use sockets. The native process can be a
server and the .NET process could be a socket client, and hence it would
be able to 'talk' to the native process. The internet is awash with
examples of writing socket clients and servers in .NET and with Winsock.

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Dec 11 '05 #2

P: n/a
Thanks Richard Grimes,
It's really help me for a jump start, I appeciated that
Have a great day
Anthony

"Anthony" wrote:
Hello All,
Thanks for your help first, I wonder is there any link to sample or
documentation that explain how to make .exe in C++ communicate to .exe in C#?
I know there is some way like Share Memory, COM but I really need a
place that I could get jump start
Thanks
Have a wonderful day

Anthony

Dec 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.