Skip to main content

Instructor-led training

MFC Windows Programming for C++ Programmers Training in Englewood, New Jersey

This course is a very thorough presentation of Windows programming via an object oriented approach using Visual C++ and the Microsoft Foundation Class Library.

What you'll learn

This course is a very thorough presentation of Windows programming via an object oriented approach using Visual C++ and the Microsoft Foundation Class Library. The course consists of two modules. The first module covers the essential elements of Windows programming via an object oriented approach using Visual C++ and the MFC. The basic structure of Windows programs and the MFC encapsulation is explained, and then the power of MFC and the Visual C++ development environment is exploited to build working Windows applications. The student will gain experience using the Visual Studio, AppWizard, and ClassWizard. Fundamental Windows programming topics are covered, including the mouse, keyboard, Graphics Device Interface, controls, dialog boxes, menus, toolbars and status bars. The document/view architecture is introduced. A fundamental approach is taken to understanding MFC, building programs by making direct calls to MFC before using automated tools. The second module covers intermediate topics in MFC Windows programming. Mouse programming techniques are discussed, including rubberbanding and drag and drop. Additional topics in dialog boxes are covered, including the common dialogs and programming modeless dialogs. Fonts are discussed. MFC services are covered, including runtime type information, serialization, diagnostics and exceptions. The MFC collection classes are surveyed, including the template collection classes. Document/view architecture is presented in greater depth, including MDI and the role of document templates in dealing with multiple view types and multiple document types. The student is introduced to a number of advanced topics, including the MFC database classes, the Win32/64 common controls, and DLLs. OLE and ActiveX are introduced, including use of ActiveX controls. Extensive programming examples and exercises are provided using Visual C++ 2008 (Library mfc90.dll). Besides doing standalone exercises, during the course the student will develop several cumulative Windows applications. A disk is provided containing all the examples and laboratory exercises in the course.

Private Training for Teams

This course is offered as private, instructor-led training for organizations, onsite in Englewood, New Jersey or live online. Dates, delivery format, and course content are arranged around your team's requirements.

This course is not currently scheduled as a public class for individual enrollment.

Request Group Training

Prerequisites

Knowledge of C++. Previous SDK Windows programming experience is not required.

Course Outline

Introduction to Windows Programming and MFC
Structure of Windows Programs
Application Frameworks
Class Hierarchy of the MFC Library
CWinApp and CFrameWnd Classes
Event-Driven Programming
Windows Messages
Message Maps

User Input in Windows
Mouse
Using ClassWizard
Using Spy++
Invalidating the Client Area
Keyboard

Graphics Device Interface
Device Contexts
GDI Object Creation and Cleanup
Colors
Pens and Brushes
Drawing with Text

More About Windows
MFC Encapsulation of Windows
Window Creation and Destruction
Focus and Activation
Sending and Posting Messages
Overlapped, Popup and Child Windows
Child Windows and Owned Windows

Document/View Architecture
Using AppWizard
Document and View Classes
Document Templates
SDI and MDI Applications
Document/View Program Structure
Synchronizing Document and Views
Making a Document Persistent

Menus and Resources
Resources in Windows Programs
Developer Studio Resource Editors
String Tables
Menus and Command Messages
Update Command UI Messages
Keyboard Accelerators

Controls and Dialogs
Modal and Modeless Dialog Boxes
Resources and Controls
Controls as Child Windows
CDialog Class and Programming a Modal Dialog
Designing Dialogs with Dialog Editor
Using ClassWizard
Dialog Data Transfer

Toolbars and Status Bars
Command Messages
MFC Control Bar Classes
Toolbars
Idle Time Processing
Tooltips
Status Bars

Mouse Techniques
Mouse Messages
Mouse Handler Functions
Capturing the Mouse
Mouse Cursor
Rubberband Drawing
Drag and Drop

MFC Services
General Purpose Classes
Serialization and Persistent Objects
Diagnostics
Exceptions
Runtime Type Information in MFC

MFC Collection Classes
List, Dynamic Array and Map Classes
Making Collection Objects Persistent
MFC Template Collection Classes

More About Dialog Boxes
Modeless Dialogs as Child Windows
Communicating Between a Dialog and its Parent
Programming a Modeless Dialog
Combo Boxes and List Boxes
Common Dialogs
Fonts
Common Font Dialog

More About Document/View
Multiple Document Interface
MFC Classes that Implement MDI
Implementing MDI Applications with MFC
Multiple View Types
Special View Classes
Form View Based Applications

Windows Common Controls
Win32 Common Controls
MFC Common Control Classes
Progress and Slider Controls
Tree View Control

MFC Database Classes
ODBC Architecture
MFC Classes for ODBC
Record Field Exchange
Scrolling in a Recordset
Choosing a Data Source at Runtime
Record Sets and Record Views
Data Access Objects
MFC Classes for DAO

Dynamic Link Libraries
What is a Dynamic Link Library (DLL)
Creating a DLL
Debugging a DLL

Introduction to ActiveX
COM, OLE and ActiveX
ActiveX Controls
 

Why MFC takes deliberate study

MFC is a framework that calls your code, so the hard part is knowing where the framework expects your code to go. Most of the syllabus is about those hook points.

  • Event-driven flow. The course starts with Windows messages, message maps, CWinApp and CFrameWnd, and invalidating the client area. Until you see how a mouse click or keypress becomes a handler call, later topics look like magic.
  • Resource ownership. The GDI material covers device contexts, GDI object creation and cleanup, pens, brushes and colors. A common mistake is treating these as ordinary C++ objects when the underlying handles must be released correctly.
  • Document/view. This is the biggest conceptual step. It covers document templates, SDI versus MDI, synchronizing documents and views, and making a document persistent. Later sections return to it with multiple view types, form views and special view classes.
  • Dialog lifetime. Modal dialogs, modeless dialogs as child windows, dialog data transfer, and communication between a dialog and its parent behave differently, and mixing them up causes subtle bugs.

A frequent misconception is that the wizards write the program. The course builds applications with direct MFC calls first, then introduces AppWizard and ClassWizard, so you can read and repair generated code. Spy++ is included for inspecting messages.

The second half moves to services and integration: serialization, diagnostics, exceptions, runtime type information, collection classes, ODBC and DAO record sets, DLLs, and an introduction to COM, OLE and ActiveX controls.

Who it suits and what to take around it

The course is rated general level. It expects working knowledge of C++ but no prior SDK-style Windows programming. It suits developers who build, maintain or extend existing MFC desktop applications, and teams taking over such code.

If your C++ is rusty, C++ Programming covers the language foundations that MFC's class hierarchy and macros assume.

MFC's collection classes (list, array, map and the template collections) are covered here. A team that wants the standard library's approach can pair this with C++ Standard Template Library to compare the two.

For organizations that are moving MFC code toward managed code, .NET Framework Using C++/CLI is a logical follow-on. It covers working across native and managed code. The full list is in the C++ Programming courses and learning guide.

Illustrative scenarios

The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.

  • A multi-document viewer. A team might maintain an MDI application where one document type opens in several view types. The document templates, multiple view types, form views and synchronizing documents and views all apply. Serialization handles saving and loading.
  • A data-entry front end. For example, a department tool may present database records through form views. This draws on the ODBC architecture, record field exchange, scrolling in a recordset, choosing a data source at runtime, and the common controls such as tree views.
  • An interactive drawing tool. A team might add rubberband selection, drag and drop, and a custom cursor to a graphics tool, with toolbars, tooltips and status bars around it. This uses mouse capture, the GDI topics, and command messages with update-command-UI handlers.

AI coding assistants with MFC code

AI coding assistants can help with explaining an unfamiliar message map, summarizing what a wizard-generated class does, drafting a dialog data-exchange routine, or turning a compiler error into plain language. They are useful for orienting yourself in a large legacy code base.

They tend to fail in specific ways on these topics:

  • They may suggest frameworks or APIs that do not fit the MFC version your project builds with.
  • They can leave GDI objects selected into a device context or never released, which the syllabus's cleanup topic addresses.
  • They can wire handlers incorrectly, putting message map entries or command-update logic in the wrong class, or mixing up modal and modeless dialog lifetimes.
  • They may produce serialization code that does not match an existing file format.

To verify, run the code and watch the actual messages in Spy++. Use MFC's diagnostics and exception handling for checks, and test persistence by saving and reloading documents. Review every change against the document/view structure the application already uses.

Frequently asked questions

What level is this course and what do I need beforehand?

It is general level. You need knowledge of C++. Previous SDK-style Windows programming experience is not required, because the course starts with the structure of Windows programs and messages.

Does it teach with wizards or by hand?

Both, in sequence. The course builds programs with direct MFC calls first, then introduces AppWizard and ClassWizard so you understand the code they generate.

What does the second half of the course cover?

Intermediate and advanced topics: mouse techniques such as rubberbanding and drag and drop, common dialogs, fonts, serialization, diagnostics, exceptions, collection classes, MDI and multiple view types, common controls, ODBC and DAO database classes, DLLs, and an introduction to ActiveX.

Can this be delivered privately for our team?

Yes. HSG delivers private training onsite at your location or live online.

Can the content be customized to the versions we use?

Private courses can be tailored to the technology versions an organization uses, including current releases. You can describe your environment through the training proposal request.

Training locations

MFC Windows Programming for C++ Programmers training across the U.S. and beyond.

We provide private MFC Windows Programming for C++ Programmers training for organizations, onsite at your location or live online, throughout the United States and internationally.

View all MFC Windows Programming for C++ Programmers training locations

Train your team with HSG

Private, instructor-led training customized for your organization.

  • Onsite or live online delivery
  • Customized curriculum
  • For a single employee or an entire team
  • Flexible scheduling
  • Experienced instructors
Request Group Training

Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com

Ready to train your team?

Let's customize this training for your organization.

Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.