Communication between c++ and c# applications

  • Thread starter Thread starter George Chen
  • Start date Start date
G

George Chen

Hi

I have lots applications are already written by emberded c++. It 's easy
to use
PostMessage in one application and catch this message in another
application's WndProc Function.
Here is my c++ code:
App a:
#define WM_SCANBARCODE WM_APP + 100
::PostMessage(HWND_BROADCAST, WM_SCANBARCODE , 0, 0);
App b:
case WM_SCANBARCODE: // WM_SCANBARCODE = WM_APP + 100
break;

Since .net have some powerful library like web service. I use C# to
develop new
application. But I do not know how to using simlar function in C# to
communication to my exist C++ application.



Any help would be appreciate.

George chen
 
There are a whole range of inter-process commnication options available.
Daniel sums them up well in this article (and part two linked at the end)
http://www.danielmoth.com/Blog/2004/09/ipc-with-cf-on-ce-part-1.html

In your specific example you can use windows messages back and forth between
your managed app and a native app - see the
Microsoft.WindowsCE.Forms.MessageWindow class which you can derive from and
override the WndProc to capture incoming messages, there are also
SendMessage and PostMessage methods.

Peter
 
Back
Top