Posted By: Pete Brown | Mar 13th @ 3:31 PM | 27,531 Views | 11 Comments
While on campus for the MVP Summit in February, I had a chance to visit Henry Sowizral over in building 41. Henry Sowizral is a Principal Architect in Microsoft Expression, and he and his team did something really cool: they converted an existing C/C++/MFC application to have a WPF front-end, while still leveraging all that existing code.

If you have legacy code and are considering porting the UI to .NET, pick up some pointers from Henry.

Once you've finished, check out Henry's presentation deck on how the team converted the Expression Design UI to WPF.

See more WPF at Pete's site and blog http://10rem.net
Follow Pete on twitter at @pete_brown
Rating:
1
0

Awesome video and very timely. I'm currently involved in trying to drag a 16 year old MFC application kicking and screaming into the WPF present and future.

can you please post a sample showing how to change a C++ control to WPF ?

Yes ... and moreover, best practices to follow. You can put it in the comments or a readme.txt file along the sample. Can you please talk or write about some ownerdrawn controls switching over scenario?  Thanks

Was it slow as molasses after the conversion with all of the WPF bloat, sort of like Visual Studio 2010?

Nice to see you're running Windows XP in the background, though. I found that highly amusing in a post about converting legacy code.

if you are planning to post a sample and the best practice notes... could please notify me or tell me where I can expect it to show up !!!

If you grep for HwndSource and in particular the "AddHook" tweak you'll get a long way with your MFC / WPF mash-ups. There are some pain points about using RenderTargetBitmap and then converting the resulting bitmap to a MFC compatible 24 bit RBG bitmap form that you can say put into a MFC ribbon - but it's all very doable. If you're not using Dev 10, i.e. you're using Visual Studio 2008 then I'd recommend doing your work in a 32 bit environment, you're going to be stepping a lot between C++, C++/CLI and C# and you will want mixed-mode debugging. I couldn't imagine doing this stuff in 64 bit before the advent of mixed-mode.

If you want your business application to resemble an ATM machine, you will use WPF. If you want it to look professional (i.e., like office), you will use MFC and a good toolkit such as Codejock for ribbons and views.

Microsoft Communities