3

I am responsible for the User Interface of an application written completely in Visual C++ using MFC and some third-part controls. I would like to use C# (WinForms or even better WPF) to improve the application look&feel.

I would like some advices about how to do it. Links, articles, examples...

Right now the user interface is isolated in a single project and I don't want to compile the whole module with CLR. So how do I have to manage that from the architectural point of view?

I have already looked at the Internet for the subject and read MSDN information. I would like more detailed information...is it convinient? pros/cons? have you used this approach successfully in a "big" application? I don't want to compile the whole ui project with CLR...can I just have all the .NET code in a isolated project and call it from the ui project? what's the best way to do it?

Thanks in advance.

Javier De Pedro
  • 2,219
  • 4
  • 32
  • 49
  • Are you aware that many of the visual styles you might expect aren't available in .NET? You can't expect your program to look like MS Office 2003 or even 2007 apps out of the box. You still need add-in software for WinForms to achieve that, as it's not part of the standard .NET package. – steffenj Oct 10 '08 at 11:05

3 Answers3

1

A good starting point is the Win32 and WPF interop page on MSDN.

David Schmitt
  • 58,259
  • 26
  • 121
  • 165
1

I found this codeproject article gave a good introduction to the subject of mixing mfc / winforms code.

John Sibly
  • 22,782
  • 7
  • 63
  • 80
1

When faced with the same problem, I made an ActiveX control in C# and used it in my MFC app. The folks at MS took out support for building ActiveX controls with .NET, but it's still possible to do so with a plain Jane COM class which has a custom [ComRegisterFunction()] and [ComUnregisterFunction].

Although MS would like to tell us that the /clr flag will solve our problems, it measurably slowed down my large MFC app.

Nick
  • 13,238
  • 17
  • 64
  • 100