Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

What are the similarities between MFC and WPF?

Is it worthy to learn MFC before WPF?

share|improve this question
add comment

closed as primarily opinion-based by gnat, BЈовић, Martijn Pieters, Doc Brown, ChrisF Mar 19 at 8:57

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

5 Answers

Both MFC and WPF (along with Windows Forms, VB6 forms, and plenty of other things) contain concepts that come from the Windows UI - the basic set of controls (button, text box, checkbox etc), the idea of properties for those controls (text, contents, checked...) and that some properties are common to all controls while others are just for certain controls. They also have the idea of separating the definition of the UI (I want the button to be blue, and to have Click Me on it) from the code that runs when you interact with the UI.

However, the actual nuts and bolts of how they work, and what you learn while you're first using them, could hardly be more different:

  • MFC is for native C++ development, WPF is for managed code, primarily C# and VB. In theory you can do WPF in C++/CLI but the absence of a designer makes that pretty much a nonstarter
  • MFC "declares" the UI in code that is generated by a designer (x = new Button(...); kind of thing) while WPF "declares" the UI in XAML ( <Button> ... </Button> kind of thing.)
  • MFC contains a TON of classes that are not about UI, from the relatively harmless CString to the don't-go-there CDatabase.

If you're a C++ developer, don't learn C# so you can learn WPF. Instead, get your feet wet in XAML development by writing C++/XAML apps for Windows 8. (It's not hard.) If you're a C# developer, ignore MFC, it's not for you.

share|improve this answer
2  
(Added as a comment so it can be removed if anyone objects) I wrote a course on Win 8 C++ XAML development. It's at pluralsight-training.net/microsoft/Courses/… –  Kate Gregory Mar 5 '12 at 13:15
1  
though to be fair, MFC declares its code in a .rc file with "BUTTON, x,y,w,h" type semantics. Its not that different though WPF has more flexibility. –  gbjbaanb Mar 5 '12 at 13:50
    
+1 For a list comparing actual features of each –  maple_shaft Mar 5 '12 at 13:54
add comment

MFC is an old class based wrapper around Win32, its not particularly difficult to learn and use but it is pretty much legacy today.

WPF is a .NET only GUI technology based around an XML-style declarative layout. This is kindof like HTML with javascript, only it used C# for the code-behind aspects.

So they're totally different.

You should look into a few more options before making your mind up. There's the well-respected Qt for C++ developers (and its extensions in the form of QML and Wt), or HTML. Microsoft has said that HTML5 is its (new) primary GUI technology and a lot of other companies are doing work with it, so you might see more developer resources ploughed into that compared to all the other GUI technologies put together.

share|improve this answer
add comment

MFC and WPF are completely different technologies and methodologies.

If you are getting into Windows desktop development right now then I'd recommend just learning WPF - this is the skill that will be transferable to to Metro development (both use XAML to define the UI).

MFC was used for C++ projects before .NET was developed and is effectively dead - except for legacy projects.

share|improve this answer
add comment

MFC was a nice framework for its time. It let you abstract the Win32 API, and made things much simpler to develop, especially when it came to GUI and MVC development. I developed in it for several years, it was much nice than using straight Win32 api.

There is nothing particularly terrible about MFC. Bad software can be written in any language. And there certainly is a learning curve to MFC, as there is to any other language. Add in a badly written application, and I can see confusion happening.

In fact as I've developed WinForms, WPF, etc, I've found the basic concepts of windows development really hasn't changed. You still have buttons, dialog windows, events, threads, mutexes, etc, etc....

share|improve this answer
add comment

If you wish to learn C++ and have a future in the language then avoid MFC like the plague. Nobody uses it anymore unless they are maintaining an old legacy application. I worked at one place where I was assigned to fix a few bugs with a legacy MFC application and silly me, I thought that since I had a little C++ experience that I could just "pick it up". It was one of the few times I found myself completely in over my head and thoroughly confused.

I couldn't tell if the application was designed and written poorly or if MFC was just an awful framework. Fortunately I wasn't the only developer to have problems with it at that company, they eventually decided to rewrite the application in WPF and with good design and unit tests the application turned out rather extraordinary.

There is still work in MFC but you probably don't want these kinds of jobs. WPF is more modern, and if your strengths are in C++ then just about any other C++ UI framework is preferrable to MFC.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.