What are some techniques for migrating a large MFC application to WPF/.NET?

Revisiting this because I have successfully replaced our top level MFC UI (the main frame, windows, and toolbars) with WPF.

As it turns out, our core drawing code merely needs to be handed an HWND to render into. This made it really easy to reuse the bulk of our existing C++ codebase.

Here’s a quick rundown on the key pieces of the approach I took:

  • Used the .NET HwndHost class to host an HWND for the C++ drawing code to render into
  • Created C++/CLI wrappers for any native C++ code that needed to be exposed to the WPF/C# UI code
  • Left most of the MFC dialogs as-is in the native C++ code. This minimizes the amount of work needed to finish the UI. The MFC dialogs can be migrated to WPF over time.

As a side note, we’re using SandDock and SandRibbon from Divelements and have been very happy with them so far.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)