Calling c# code from c++

Y

Yoavo

Hi,
I have an C++ MFC application and a c# DLL (which contains a Form class).
I want to invoke the c# dialog from the C++ application.

How do I do it ?

thanks,
Yoav.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You have to make the DLL visible to COM ( a check mark in the project
properties )

Then ou can use it as any other COM component
 
C

Carl Daniel [VC++ MVP]

Yoavo said:
Hi,
I have an C++ MFC application and a c# DLL (which contains a Form
class). I want to invoke the c# dialog from the C++ application.

How do I do it ?

If you are compiling your MFC application with VC++ 2005, then you can
easily add a managed module to your MFC application to call the C# dialog.
There's also a CWinFormsView class that lets you host a WinForms form inside
an MFC View object, so it can interact with the rest of your UI just like
any view.

If you're using VC 7 or 7.1, you can still add a managed module to your MFC
application to provide the bridge to the C# form.

If you're using VC6 or earlier, then COM interop is about your only option.

-cd
 
Y

Yoavo

Hi Carl,
Does your first solusion ("add a managed module to your MFC...") relevant
for unmanaged application (my MFC application is unmanaged).
If so, how do I add a managed module to my MFC application ?

Yoav.
 

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