Call managed code from unmanaged

  • Thread starter Thread starter Yoavo
  • Start date Start date
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.
 
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
 
Back
Top