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