13.5.  Miscellaneous Continued (2/3)

Microsoft Visual C++/Microsoft Foundation Classes


13.5.  Miscellaneous Continued (2/3)

13.5.5. How should I learn/start-learning MFC?

I see this posted lots. To start with, check out section 2.4.2 of this FAQ, books always help. Another good point is that you can't really get down and dirty in MFC without knowing and understanding the underlying Windows API, so you might want to start with an overview of that. (The 'Petzold' book is the classic here) At the very least get a feel of what windows does and what it's capable of.

Another hint I have is don't rely too much on the Wizards, these are great, but they sometimes shield the newbie too much. Take a look at what AppWizard/ClassWizard has done for you, run the debugger through a mainfrm.cpp, etc.. You won't understand what the heck is going on until you understand what your magically generated code is doing.

I thought the 'writing windows apps with MFC' book was a good merge between Petzold and intro MFC stuff. 'Inside Visual C++' may move too fast for someone that doesn't know Windows already.

[email protected], 7/27/95

  • There's no substitute for paying your dues.
  • Unfortunately MFC is set up so that you're never done paying your dues. (HAHAHAHA!!!)

[email protected], mfc-l, 7/23/95

Start with the VC++ User's Guide and work your way through the Scribble Tutorial. You get an intro to VC++ and MFC and see how they work together. Then there are numerous articles on the MSDN CD to help with basic concepts. Try searching on MFC and Architecture. Don't shy away from reading the MFC Encyclopedia articles (they take more of a 'how-to' approach) and by all means become familiar with the MFC Technical Notes. Also (hint), stay focused on the 32-bit stuff if you're just starting out. There are also a number of excellent journals out there to help.

[email protected], mfc-l, 7/23/95

The important points (of the top of my head) are:

If you're a windows programmer, don't worry about graphics.  The CDC member functions are an almost direct encapsulation of the Windows functions. Also CWnd encapsulates much of the window manipulation functions.

Learn the Document-View architecture: document templates, the interaction between the application, the documents and views (AfxGetApp, GetDocument, UpdateAllViews etc).

Learn serialization (scribble makes a good intro to it). DDX and DDV for dialog boxes: there is a good tech note on this. WM_COMMAND handlers, COMMAND_UI handlers (which allow you to enable/disable menu items as well as applying check mark and radio button marks on menu items, it also gives you one way to use status bars).

During all this you'll also learn how to use ClassWizard and see how it is integrated with the editor and resource editor. Perhaps as part of the MFC FAQ we could create a list of topics (ordered in terms of importance) to learn? {Sure, this is a good start, no? -Scot}

[email protected], mfc-l, 7/24/95

See also: Want to learn more about MFC?

13.5.6. What's the best way to convert my C Windows App to MFC?

Microsoft and Symantec have jointly developed a tool that helps you make the move from a C Windows application to MFC. It's called the MFC migration kit. You can find it on the MSVC 2.x CD-ROM in the MFCKIT directory. The kit is also available from the Microsoft Software Library (See section 2.1.4) and from Symantec.

13.5.7. Why is my MFC application running slow?

MFC Apps should be nice and snappy. Make sure you are not building the debug version and that you have the trace options off (MFCTRACE.EXE). If your application continues to be slow, try doing some quick profiling to see if you are making any redundant calls.

[email protected], 5/31/95

13.5.8. What is afx.inl and afxwin1.inl, etc..?

These files live in the msvcXX\mfc\include directory and include inline functions. These functions are only 'inline' during non-debug (_DEBUG is not defined) builds of MFC. They are prefaced with a special _AFX_INLINE directive which gets turned into 'inline' for non-debug builds and '' for debug builds.

MFC does this so you can debug into the functions in debug mode, but get the benefits of inlining during release builds. That's one of the reasons the library shrinks so much in release build mode.

[email protected], 7/20/95

13.5.9. What the heck is this _T() thing I keep seeing?

_T is a macro to expand the string literal to support unicode.

Mike Oliver, MSMFC, 8/1/95

BACK... / NEXT...