What I need to learn before MFC?

Posted on 2004-09-09
Last Modified: 2013-11-20
I am new to C++ and MFC, I have taken a community college course in C++ where the last thing we learnt was functions, now i am taking the next class where I will be learning classes, OOP etc.

My question is...can I start learning MFC with this limited knowledge, or should i wait until I have learnt Classes and other more advanced C++ concepts before diving into MFC?

Question by:KalluMama
LVL 16

Assisted Solution

nonubik earned 50 total points
ID: 12018934
>or should i wait until I have learnt Classes
MFC stands for Microsoft Foundation Classes. The Microsoft Foundation Class Library is an application framework for programming in Microsoft Windows. Written in C++, MFC provides much of the code necessary for managing windows, menus, and dialog boxes; performing basic input/output; storing collections of data objects; and so on. All you need to do is add your application-specific code into this framework. Given the nature of C++ class programming, it is easy to extend or override the basic functionality that the MFC framework supplies.

LVL 49

Accepted Solution

DanRollins earned 100 total points
ID: 12023160
One thing about MFC is that it is nicely integrated into the VisualStudio IDE development environment with its very useful Wizards that generate a lot of the code for you.

That means that with a few clicks, you can create a program that actually does something visible on the screen.   For my money, being able to display a dialog box and have something happen when you click a button in it (say, display a message box) is 1000 times more satisfying than the console-based stuff they teach in C++ 102.

The inner workings of MFC are deeply OOP and probably beyond your current level, but just like the fact that people drive cars without knowing how they work, you can use VC/MFC to "get somewhere" without needing to understand its complexities.

So my recommendation is to "play around" with Microsoft VC++ and MFC... maybe just enough so that you can use your new C++ skills as you learn them.

-- Dan
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 50 total points
ID: 12023586
Although you can work with MFC with minimal classes knowledge, I think you have to learn classes first to do anything different to simply cut and paste examples from the internet.
MFC is strongly related to classes, countersense to WinAPI, also could be a good idea to learn some of WinAPI befor MFC to know what it happening at the "internals" of MFC.
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!


Author Comment

ID: 12026400
So what I gather from this is that I atleast need some basic Classes knowledge before trying MFC. Since i trying to make some changes to a small existing application, are there any other things that I should know before working with an application written using MFC? Coz right now when i look at the code it looks absolutly foreign to me...this is after having a basic C++ class....
LVL 49

Expert Comment

ID: 12035633
MFC is all about pre-written class objects --- just classes that you would have to write yourself if somebody else hadn't already done it.  So the real source of information is MSDN which provides a full diescription of each of these pre-written classes.  

If you are working with somebody else's code and you see an object named, for instance CMyDlg, then go to the header file for that class and see that it is derived from CDialog.  Put the cursor on the word CDialog and press the F1 Key.  That's how to learn MFC :-)

Assisted Solution

CmdrRickHunter earned 50 total points
ID: 12037309
Knowing what a class is, and having some idea of the syntax will help quite a bit.  It will also help to know something about dynamic memory allocation (using new and delete), but its not always necisary.

My advice would be to go to Boarders or Barnes and Noble, grab a teach yourself C++ book (or similar), and read their chapters on the basics of classes, and how to derrive classes.  Then read their section on dynamic memory.  Don't worry if you dont actually understand it, what is more important is that you have at least seen the concepts in a "teaching" usage before being thrown into MFC.  It will help you quite a bit when you see CMyDialog: public CDialog   and you actually comprehend what is going on there.

Then follow examples... find tutorials, and just poke around.  Dont worry, no matter how you learn MFC, you'll have to unlearn half of it when you learn the proper way to do it, but its okay... its the process.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now