PC Review


Reply
Thread Tools Rate Thread

C# and C++ share memory

 
 
=?Utf-8?B?QW50aG9ueQ==?=
Guest
Posts: n/a
 
      8th Jan 2005
Hi,
Is there any sample codes or documents about how to send and receive the
messages between C++ and C# applications? For instance, I have a C++ dialog
application and C# dialog application running on same computer, how do I
transfer data back and forth between these two?
Thank you very much
Best regards,
Anthony
 
Reply With Quote
 
 
 
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      8th Jan 2005
You can create a managed C++ wrapper for your DLL or use COM or use interop
to import DLL functions.
In the latter two cases marshalling will be a big issue and you may have to
create manages structs that mimic the layout of your C++ structs.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Anthony" <(E-Mail Removed)> wrote in message
news:3B331D78-D960-448C-914A-(E-Mail Removed)...
> Hi,
> Is there any sample codes or documents about how to send and receive the
> messages between C++ and C# applications? For instance, I have a C++
> dialog
> application and C# dialog application running on same computer, how do I
> transfer data back and forth between these two?
> Thank you very much
> Best regards,
> Anthony



 
Reply With Quote
 
Joakim Karlsson
Guest
Posts: n/a
 
      8th Jan 2005
Anthony wrote:
> Hi,
> Is there any sample codes or documents about how to send and receive the
> messages between C++ and C# applications? For instance, I have a C++ dialog
> application and C# dialog application running on same computer, how do I
> transfer data back and forth between these two?
> Thank you very much
> Best regards,
> Anthony


There are a lot of options you can choose from. Named pipes, shared
memory, DDE, remoting... Depends on your particular need.

Quick googling gave the following:

Named pipes:
http://www.codeproject.com/csharp/Do...PipesPart1.asp

Named Shared Memory:
http://www.dotnetconsult.co.uk/weblo...5-39ca338d906d

DDE:
http://weblogs.asp.net/savanness/arc.../05/41595.aspx

/Joakim
 
Reply With Quote
 
Niki Estner
Guest
Posts: n/a
 
      8th Jan 2005
"Anthony" <(E-Mail Removed)> wrote in
news:3B331D78-D960-448C-914A-(E-Mail Removed)...
> Hi,
> Is there any sample codes or documents about how to send and receive the
> messages between C++ and C# applications? For instance, I have a C++
> dialog
> application and C# dialog application running on same computer, how do I
> transfer data back and forth between these two?


You can choose virtually any IPC (interprocess communication) technology
Win32 has. I would probably implement both "ends" in one language (C++), and
use an MC++ wrapper from C#, but you can probably do the same using
P/Invoke.

Have a look at:
http://msdn.microsoft.com/library/de...unications.asp

Assuming the C++ application is managed, you can of course use .NET
remoting.

Niki


 
Reply With Quote
 
=?Utf-8?B?QW50aG9ueQ==?=
Guest
Posts: n/a
 
      8th Jan 2005
Thank you so much for your info. you all really help me out
Best regards,
Anthony

"Niki Estner" wrote:

> "Anthony" <(E-Mail Removed)> wrote in
> news:3B331D78-D960-448C-914A-(E-Mail Removed)...
> > Hi,
> > Is there any sample codes or documents about how to send and receive the
> > messages between C++ and C# applications? For instance, I have a C++
> > dialog
> > application and C# dialog application running on same computer, how do I
> > transfer data back and forth between these two?

>
> You can choose virtually any IPC (interprocess communication) technology
> Win32 has. I would probably implement both "ends" in one language (C++), and
> use an MC++ wrapper from C#, but you can probably do the same using
> P/Invoke.
>
> Have a look at:
> http://msdn.microsoft.com/library/de...unications.asp
>
> Assuming the C++ application is managed, you can of course use .NET
> remoting.
>
> Niki
>
>
>

 
Reply With Quote
 
Sahil Malik
Guest
Posts: n/a
 
      9th Jan 2005
Kernel32.dll functions -->

MoveMemory
CreateTextFileMapping
OpenTextFileMapping

<--- these will let you do what you need to do.


- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


"Anthony" <(E-Mail Removed)> wrote in message
news:3B331D78-D960-448C-914A-(E-Mail Removed)...
> Hi,
> Is there any sample codes or documents about how to send and receive the
> messages between C++ and C# applications? For instance, I have a C++
> dialog
> application and C# dialog application running on same computer, how do I
> transfer data back and forth between these two?
> Thank you very much
> Best regards,
> Anthony



 
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
VGA share memory Happy Windows XP Help 2 23rd Apr 2005 07:02 PM
VGA Share memory Happy Windows XP Help 0 22nd Apr 2005 09:18 PM
VGA share memory, where do I set this? Glenn Microsoft Windows 2000 2 9th Dec 2004 08:21 PM
What's share memory ?? Jason Jacob Microsoft VB .NET 2 25th Jun 2004 01:52 PM
Share Memory Reggie Microsoft Windows 2000 Networking 1 28th Apr 2004 09:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 AM.