Call managed code from unmanaged

Y

Yoavo

Hi,
I have an C++ MFC application (Unmanaged) and I want to add to this
application a c# DLL which contains dialogs.
The comunication between the C++ application and the c# DLL should be in
both direction.
How can I do it ?
what is the best way ? (I realized that it can be achieved through COM or
MC++).

Yoav.
 
W

William DePalo [MVP VC++]

Yoavo said:
I have an C++ MFC application (Unmanaged) and I want to add to this
application a c# DLL which contains dialogs.
The comunication between the C++ application and the c# DLL should be in
both direction.
How can I do it ?
what is the best way ? (I realized that it can be achieved through COM or
MC++).

I hate to use adjectives like "best" in the news groups because the "best"
way is sometimes subjective and always dependent on the exact details.

That said, I posted a generic example of native code calling managed code
here:

http://groups.google.com/group/micr...rosoft.*+author:depalo&hl=en#ad2dcbc2def47d35

And MSDN has a sample that shows how an MFC application can use WinForms
here:

http://msdn2.microsoft.com/en-us/library/ms239718.aspx

(I think that VS2005 is required)

As for communicating _from_ the managed side, there is always Platform
Invoke.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top