I'm currently working with C++ MFC applications in Visual Studio 2008. I have spent most of my time up to this point working with Java Swing development which seems to be not quite as involved as win32 or MFC are. I've noticed that there seems to be a lot of little parameters and specifications that go into creating even a simple element like a status bar or menu bar. I've spent a bit of time working through the MSDN library on the matter but it doesn't seem to explain why many of these parameters and such are needed to set up these elements. I always find that I'm able to wrap my head around things and remember them if I understand why I'm doing it. If you program using MFC (or a similar framework) what did you find helpful in the learning process? Do you recommend any website, books, or other references? Any and all advice is appreciated!
-
1MFC is hard because it was developed for a 20-year-old version of the language, not because MFC is hard conceptually.– DeadMGCommented Oct 13, 2011 at 14:58
-
It is more that it was developed for 20 year old hardware limits, when systems had 8MB Memory. At this time every bit counted and a windows clock app was possible with only 24kb, while GTK requires 2MB.– LotharCommented Jan 22, 2012 at 23:01
4 Answers
I'm no MFC expert but have used it off and on over the last several years. It doesn't always follow a standard convention and is based a lot on the underlying Win-32 API. If your stint is short lived, you might want to look at Programming Windows with MFC (the link is for you read reviews, I'm not advocating the retailer)
If you are going to be using MFC for a while, learning the Win-32 API might not be a bad idea. Programming Windows is good. I read it long ago in the 16-bit days.
Using the MSDN can be confusing, but the MFC Class Hierarchy might be a good jump off point. When searching, I will preface any searches w/ "MSDN" and "MFC" then what you want.
This isn't exhaustive, but I hope it helps you to find some bearings.
To answer the unasked question: yes, working w/ MFC is 2-4 times slower than using Java, C# or similar.
-
Is C# similar to Java in terms of ease of window/app development? I know its kinda an apple to oranges kind of question... And thanks for pointing out the Class Hierarchy! I hadn't stumbled on that yet. It will be quite helpful!– KennethCommented Mar 22, 2011 at 18:03
-
You can use C# and create WinForms apps that, when compared to MFC are far easier for most cases. The .NET framework is far more consistent and easier to follow IMHO. I can't really make the comparison to Java, as I have no experience. If I could choose between C# and WinForms or MFC, it would be C# hands down.– DevSoloCommented Mar 22, 2011 at 18:13
-
I found MFC Internals by Shepherd/Wingo an excellent resource.
Covering the internals means it's not bogged down in beginner stuff and IDE explanations and it draws quite some lines between "raw" Win32 programming and using the MFC.
In the days of MFC, my go to book was:
Think of it as an MFC cookbook chock full of pragmatic MFC code that solves specific problems. Certainly remember dipping into this book with greater frequency than any other MFC book I owned.
MFC is hard to use and learn because it is something you could call a windows assembler language. Very very low level and almost not encapsulating anything. When you do serious development you often come up with your own application specific toolkit on top of MFC.