PC Review


Reply
Thread Tools Rate Thread

Communication between c++ and c# applications

 
 
George Chen
Guest
Posts: n/a
 
      17th May 2005
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


 
Reply With Quote
 
 
 
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      17th May 2005
Look at the ApplicationEx class in OpenNETCF Smart Device Framework and use
an IMessageFilter instance that you create to detect the message's arrival.
The only situation where that won't work is if you have a modal dialog in
front. There's been a recent discussion of that, too, and you can find that
thread in the archives of the newsgroup:

http://groups-beta.google.com/group/...UTF-8&oe=UTF-8

Paul T.

"George Chen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      17th May 2005
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/...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

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net |
http://www.opennetcf.org

"George Chen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Daniel Moth
Guest
Posts: n/a
 
      17th May 2005
For sending WM messages use the Microsoft.WindowsCE.Forms.MessageWindow. For
examples of that and other IPC mechanisms start here:
http://www.danielmoth.com/Blog/2004/...ce-part-1.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


"George Chen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>


 
Reply With Quote
 
George Chen
Guest
Posts: n/a
 
      17th May 2005
That is what i want.
Thank all of your's help

George Chen


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Communication between applications =?Utf-8?B?SGFycnkgRGlsbGluZ2Vy?= Microsoft Dot NET 1 7th May 2005 02:02 PM
Communication between WMP and other applications Ola Windows XP General 0 15th Oct 2004 06:54 PM
Re: communication between applications Manoj G [MVP] Microsoft Dot NET Framework 0 9th Jan 2004 03:52 AM
Communication between two Applications Jörg Krause Microsoft Dot NET Framework 9 27th Oct 2003 04:24 PM
Communication between C++ and C# applications Thomas Nielsen [AM Production A/S] Microsoft Dot NET Compact Framework 3 17th Sep 2003 02:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:49 PM.