-
Win32 API and MFC
Sorry if this is a stupid question but i have looked all over the place and have not found a solid awnser.
What is the difference between Win32 API and MFC. I heard a while ago that MFC is an extention of Win32 API that has a structure more C++ friendly, but i am not sure please help.
-
Try this; http://www.winprog.org/tutorial/apivsmfc.html
That explains well enough what the differences are. Hope it helps.
:)
-
MFC is an acronym for Microsoft Foundation Classes. It's a wrapper for Win32 API, so basically you have a bunch of classes that supposedly make it faster, easier and neater to create Windows applications. Of course, that means you'll have to learn how to use the MFC classes, and learn to program within its structure.
I've never used MFC, so I don't know the details of how it works. From my personal opinion though, I prefer to use plain Win32 API, simply because I prefer to know what goes on 'under the hood'. It's quite messy though, until you start to figure out how to structure your program properly, and perhaps start making wrapper classes of your own. Using MFC, the structure is pretty much laid down for you, and you fill in variables/add code to functions so that it does what you want - and you end up with an application that looks and works great.
As a note, wherever I see quick GUI applications that people wrote to interface with hardware gadgets that they've built, they all use MFC. Perhaps I just haven't found them, but I've never seen one that uses plain Win32 API.
Just remember, there's no real 'wrong' choice - once you've learned one, you can always go back and learn the other. In fact, you might even be able to learn both at the same time; I'm pretty sure you can do a little mixing of MFC and API, as long as you're careful about it and know what you're doing.
**Edit**
Doh, beaten by Mr. OC :o Good article, it makes some good points.
-
I find programming in MFC easier than the winapi. For almost any MFC class it's possible to get the underlying winapi variable. But in most cases that's pointless. The MFC methods are usually like the winapi ones but shorter.
-
Thanks alot for the solid Answers, it really helped. But now i have another question, dose any one out there have any suggestions on books that teach Win32 API well, i mean really really well.
-
To start, Programming Windows by Charles Petzold. It's THE book on Win32 programming. After that I can warmly recommend Programming Applications for Microsoft Windows by Jeffrey Richter, which gives invaluable in-depth knowledge about how Windows works.
If, then, you're still interested in learning MFC, Programming Windows with MFC by Jeff Prosise is the MFC equivalent of Programming Windows, IMHO. Before that I completely shunned MFC, now I can understand that some people want to work with it ;)
-