Visual C++ 1.0: MFC and the Rise of the Microsoft Framework
It’s early 1993, and if you’ve been writing Windows apps in C using the standard SDK, you know the pain. Thousands of lines of boilerplate code just to get a window to show up and handle a few messages. But Microsoft’s new Visual C++ 1.0 is promising to change that with MFC 2.0.
The Document/View Architecture
MFC (Microsoft Foundation Classes) isn't just a wrapper around the Windows API; it’s a full application framework. The "Document/View" architecture is the big sell here. It encourages you to separate your data (the Document) from how it’s displayed (the View).
// A taste of the MFC world
class CMyDoc : public CDocument {
// Data handling here
};
class CMyView : public CView {
void OnDraw(CDC* pDC) {
pDC->TextOut(10, 10, "Hello from MFC!");
}
};
It’s a bit heavy-handed, and the macros (like DECLARE_DYNAMIC and BEGIN_MESSAGE_MAP) are everywhere, but it certainly beats writing giant switch statements for WndProc.
AppWizard and ClassWizard
The "Visual" part of the name comes from the new tools. "AppWizard" will generate a whole skeletal application for you in seconds. "ClassWizard" helps you hook up Windows messages to C++ member functions without digging through header files. It feels a bit like cheating, but when you have a deadline, it’s a lifesaver.
The Battle for the Desktop
We’re seeing a real war between Borland and Microsoft right now. Borland’s OWL (Object Windows Library) is arguably more elegant, but Microsoft has the advantage of owning the OS. I suspect we’ll be seeing a lot of MFC code in the years to come, for better or worse. I've just finished porting our internal telemetry tool to it, and while the executable size has grown, the code is much easier to navigate.