Learn the MFC C++ Classes
(Publisher: Wordware Publishing, Inc.)
Author(s): Shirley Wodtke
ISBN: 1556225121
Publication Date: 01/01/97

Introduction
Learn the MFC C++ Classes
Acknowledgment

Chapter 1—Windows and MFC
Windows Operating Systems and MFC
C++ Compilers and MFC
Windows
User Inputs to a Window
Messages
MFC and Windows OS Interaction
The Structure of an MFC Application
Creating a Main Window Using MFC
The CFrameWnd::Create() Function
Registering a New Window Class
Resource Files
Customized Icon and Cursor Resources
Summary
Exercise

Chapter 2—Menus and Message Maps
An Example With a Simple Menu
Message Maps
Menus
Accelerators
Handler Functions
Setting the Timer
Displaying a Message Box
Adding Message Map Entries With Compiler Tools
An Example That Changes Menus and Submenus
Using CMenu Objects
CWnd Functions for Messages
Summary
Exercise

Chapter 3—Graphics and Text Drawing
The Graphics Device Interface (GDI)
The Device Context
GDI Objects
Device Context Settings
Stock Drawing Objects
The CDC Class
The Device Context Classes
An Example That Draws Text and Shapes
An Example That Sets the Viewport Origin
How a Screen Repaints Itself
Creating a Pen
Creating a Brush
The RGB Macro
The Raster Drawing Mode and SetROP2()
A Graphics Editor Example
C++ Objects for the Rectangle and Ellipse
The Graphics Output Process
Deleting Drawing Objects
Drawing the Rectangles and Ellipses
The OnPaint() Function
Maintaining the Update Region
The Background Color
The Handy Utility Classes: CRect, CPoint, and CSize
Using a Private Device Context
An Example With a Private Device Context
Summary
Exercise

Chapter 4—Fast Drawing and Bitmap Graphics
Using Exclusive-or and Exclusive-nor for Fast Redraws
Details of the Exclusive-or (Exclusive-nor) Process
Limitations of the Exclusive-or (Exclusive-nor) Process
Using Backing Store for Fast Redraws
Bitmaps
Using a Memory Device Context
The CDC::BitBlt() Function
Using Bitmap Graphics for Animation
The Message Handler OnCreate()
The Message Handler OnTimer()
Device Independent Bitmaps (DIBs)
Palettes
The System Palette
Loading and Using the System Palette
Displaying a DIB Using the System Palette
Summary
Exercise

Chapter 5—Child Windows
A Child Window
The CWnd::Create()Function
Message Maps for Child Windows
User Messages
A Popup Window
A Fixed Child Window
Summary

Chapter 6—Dialogs, Common Dialogs, and Button Controls
Dialogs
Modal vs. Modeless Dialog Boxes
Common Dialogs
Class CFileDialog
Class CPrintDialog
Class CPageSetupDialog
Class CFindReplaceDialog
Class CFontDialog
Class CColorDialog
Using the ChooseColor Common Dialog
Designing Dialog Boxes
Overview of Common Controls
Window Styles for Win3.1 Common Controls
Button Controls
Static Controls
Placing Controls on the Mainframe Window
Messages To and From Button Controls
Messages From the Button Control
Messages To the Button Control
Example Program
Programming the Buttons Example
Generating the Main Window’s Code
Generating the Dialog Box Code
The Buttons Program Listing
Discussion of the Buttons Program
Summary

Chapter 7—List Box, Combo Box, and Edit Controls and Data Transfer Functions
Overview of List Box, Combo Box, and Edit Controls
Edit Control Styles
List Box Styles
Combo Box Styles
Operations and Messages for Win3.1 Common Controls
An Example Program
Programming the UsrInput Example
Generating the Main Window’s Code
Generating the Dialog Box Code
The UsrInput Program Listing
Discussion of the UsrInput Program
Data Transfer
Do Data Exchange Functions
Dialog Data Validation (DDV) Functions
CString Features
String Tables and Internationalization
Summary

Chapter 8—Communication Between Parent and Child for Modal and Modeless Dialogs
The Modal Dialog Example
The MFC Class CCmdUI
The ModalCom Program Listing
Data Transfer
Modeless Dialog Example
Modeless Dialog Creation
User Messages
Modeless Program Listing
Data Updating
Special Virtual Functions
Summary
Exercise

Chapter 9—The Document-View Architecture
The Structure of the Four Classes
Message Routing
An Example Document-View Program
The PreCreateWindow() Function
Customizing the Mainframe Window
Overriding the CFrameWnd::PreCreateWindow() Function
Mainframe Resources
Customizing the View Window
The OnDraw() Function
Message Maps
The Custom Program Listing
The Document Template
The RUNTIME_CLASS Macro
The CView Class
Views Based on a Dialog Template
Views Based on a Control
Summary

Chapter 10—Document-View Applications With Filing and Printing
Creating an AppWizard Project
Designing the Application’s Data
Designing the User Interface
The Application’s Menu
Printing the View
The Function OnPrepareDC()
Mapping Modes
Functions for Printing
Print Preview and Print Setup
Data Persistence—Filing the Document’s Data
Serialization and CArchive
The OnNewDocument() Function
Multiple Views of the Document
ElipsMin Program with Minimum Code
ElipsMin Program Listing
Discussion of the “ElipsMin” Program
Making the Dialog Box Modeless
Diagnostic Code
Summary

Chapter 11—More About Splitter Windows and Filing
The Starter Application
Multiple View Classes
Static Splitter Windows
Collection Classes
Array Collections
List Collections
Map Collections
Designing the Document’s Data
Coding the Document Class
CByteArray Member Functions
Designing the View of the Rules
Using Logical Fonts
Text Metrics
Coding the View Class Containing the Rules
Designing the View of the Game
Drawing The Tic Tac Toe Board
Drawing the Moves
Summary

Chapter 12—An MDI Application
An MDI Application
Class Structure
Characteristics
Creating New Views
Creating New Documents
Multiple Menus
Keyboard Accelerators
The CFormView Class
Creating the “Form” Program
The “Form” Starter Application
The Multiple Document Template
The Trace Macro
The Document Class
Code Additions to the Document Class
The View Class
Code Additions to the View Class
Running the “Form” Program in Debug Mode
The “FormMin” Program With Minimum Code
“FormMin” Program Listing
Discussion of the “FormMin” Program
Summary

Chapter 13—Toolbars and Status Bars
The Bars Example
Creating the Bars Starter Application
Designing the Document Class
Designing the View Class
Drawing
Adding Scrolling
Customizing the Status Bar
Adding the Handler Functions
Customizing the Toolbar
Visual C++ 4 Toolbar Editing
Visual C++ 1.5 Toolbar Editing
Using Two Document Templates
Adding a Dynamic Splitter To An MDI
Adding a Document Template
Resources for Document Templates
Summary
Exercise

Chapter 14—Custom Controls, New Common Controls, and Property Sheets
Custom Controls
The CustCtrl Example
Building the “CustCtrl” Program
The New Common Controls
Creating New Common Controls
The NewCmnCtrls Example
New Common Control Styles
Building the NewCmnCtrls Program
Getting the AppWizard Starter Application
Add the Menu Item
Create the Dialog Template
Creating the Dialog Class
Notification Messages
Property Sheets
The PropertySheet Example
Creating a Modal Property Sheet
Building the “PropertySheet” Program
Using the Apply Button
Summary
Appendix A
Appendix B
Appendix C
Appendix D
Appendix E
Appendix F
Appendix G
Index