Advertisement

MFC - AHH MY EYES!!!

Started by May 15, 2002 03:08 AM
8 comments, last by Big B 22 years, 9 months ago
Probely all the MFC pros would consider this a newbie question, so I will post here. Really, what is MFC good for? Is it supposed to be easier to use than the API? When I look at MFC, I see this: )*(&!)_&!#$_^*!^*(#@*^$_(*^_(YRIO&^*(S&$*(&@#)**@&^(^(@; It looks like a pile of gobely-gook. The API is so much cleaner, and easier - you do it yourself. Is M icrosoft F rekin'' C lueless ?
It''s all you need
If you are used to the API, MFC looks strange, I admit :-)

MFC is a set of classes that wrap the API, and are supposed to shorten the developement cycle for certain tasks.

Here some thougts that spring to mind:

MFC has some advantages:
* for simple projects, the wizard will generate the app skeleton for you, thus drastically reducing the amount of coding needed
* MFC introduces order and systematics into the code (up to a certain extent)
* MFC is C++ and you can use the benefits of inheritance

MFC also has some disadvantages:
* if you''re used to the plain API, it looks strange, and you need to accomodate to it
* it comes with a lot of overhead
* you still need to use the plain API for "unususal" tasks, and the interaction with MFC can be complicated
* it arguably has a certain number of bugs, more or less well documented


For a game, I wouldn''t take MFC, since the GUI part of the game is minimal (at leat for that sort of games I''m interested in)

For tools (map editors or so) MFC can save you a lot of coding.

My 2 cts. Btw: many plain API fans hate MFC and vice-versa (spelling?). I think it is reasonable to use the appropiate tool in each situation. Under "appropiate" I understand that tool that brings you with a minimum of effort to your goal.

Forever trusting who we are
And nothing else matters
- Metallica
Forever trusting who we areAnd nothing else matters - Metallica
Advertisement
After a while, you''ll probably get used to it. Or, you might want to try writing your own wrapper. Oluseyi wrote a nice article on that, right here.
Just out of interest, does Visual C++ have a gui editor type thing integrated? If so what code does it spit out? I''ll bet it creates MFC code and if so I would count this as something extremely helpful.
MSVC++ has a menu editor(not gui, the thing with file and edit etc), but that''s for the api and mfc and it''s a simple text file like code that is a resource (embedded info in the exe that isn''t code, you can place bmps, avi etc here)

-Scott
-Scott
MFC is ok if you want to make a word processor or something. I guess?

Otherwise stick to the Win API, it''s smaller, faster, easier.
Advertisement
MFC is excellent for getting applications that have a Windows look-and-feel (common controls, common menu bar, etc.) up and running very quickly. The more you want to customize how your program behaves, to better off you''d be going with the WIN32 API.
If you use MFC, and then decide to include a class that someone else wrote so that you can have something extra (charts, graphs, clickable links, etc.), then you really realize how much power is there behind it. I''ll admit that it is a big pain in the butt until you get over that peak and realize what all is going on though.

Overall, I''d say that MFC is great for creating tools and utilities for your games, but the game itself seems to lend itself to the regular WIN32 API. MFC is great, you just need to know when to use it to bring out its advantages.

The large percentage of people that say MFC sucks, are the ones that didn''t take the time to fully understand what it is (in my experience). It looks hard at first, but then you didn''t move into C and C++ just by looking at it either.
quote:

MSVC++ has a menu editor(not gui, the thing with file and edit etc), but that''s for the api and mfc and it''s a simple text file like code that is a resource (embedded info in the exe that isn''t code, you can place bmps, avi etc here)



Oh well, there goes my only reason for considering purchasing VC++
MSVC does have a GUI editor for MFC projects.

If you use MFC, dont piss off the wizard! He can make your life a living hell as you search for the reason that an otherwise correct program does not run.

One such occasion was when I created an MFC project and put two Rich Text controls on it. It would not run. Deleting the controls got the program to run, but now I had no text boxes. I spent a long time on this until I remade the project, checking off the "automation" check box. That was all. That bugged me to no end.

Another picky point about it is that all the tutorials you come across on the web, and even some books, are instructions on how to use the Class Wizard and the IDE. Not much real code or explanations about what goes where.

Im sure that once you get used to it, MFC can shorten project time, but it takes time before that happens, more time than I have patience for.


University is a fountain of knowledge, and students go there to drink.

This topic is closed to new replies.

Advertisement