Contents
Chapter 1: The Microsoft Developer Studio
The Microsoft Developer Studio
The Project Workspace
Project Workspace Window
Project Configurations
Managing Complex Projects
Project Settings
Converting Projects
Source Code Files
Resource Scripts
ResourceView
Creating New Resources
Identifying Resources
Dialog Boxes
String Tables
Accelerator Tables
Menus
Icons, Bitmaps and Cursors
Version Resources
Custom Resources
The Visual C++ Compiler
Compiling on the Command Line
The Foundation Classes
MFC Source Code
Header Files
MFC Libraries
Summary
Chapter 2: The Wizards and The Gallery
AppWizard
Starting AppWizard
Choosing Your Application's User Interface
Selecting Database Support
Adding Compound Document Support
Embellishing Your User Interface
Adding Advanced Features
Miscellaneous Options
Class Names
One More Step
Other Application Interfaces
Choose Carefully!
Compiling Your Application
Precompiled Header Files
ClassWizard
Creating a New Class
The .clw File
The Browser
Browser Files
Browsing
Shortcuts
Components and Controls Gallery
Summary
Chapter 3: The Application Architecture Hierarchy
The Application Framework
Generating an Application with AppWizard
Understanding the Generated Code
CDocument and CView
CWinApp
CWinThread
Locating Threads
CCmdTarget
Commands for Classes
About Message Maps
How are Message Maps Created?
The BEGIN_MESSAGE_MAP() Macro
Inside the Message Map
Filling the Holes
The END_MESSAGE_MAP() Macro
Unfolding the Map
There's No Sense of Obligation
CObject
Memory Management
Debugging Support
Serialization
Run-time Type Information
Your Own Classes and CObject
The Big Picture: A New Life
The WinMain() Function
MFC's Message Pump
Application Termination
Summary
Chapter 4: The Document/View Architecture
Documents and Views
Document/View Designs
The Different Views
Types of Document
Document/View Consciousness
What are Document Templates?
CSingleDocTemplate
Stock View Resources
The Document Template Lifecycle
Multiple Document Interface Applications
CDocTemplate::CreateNewFrame()
What Does it Really Mean?
Documents
About the Document Metaphor
Data Storage
Views
CScrollView
Control-based Views
CFormView and CRecordView
Rendering Your View
Enumerating Views
Managing Views
Printing
Print Preview
Updating Your Document
Drag-and-drop Support
How Documents and Views Interact
Managing Document/View Interdependence
Some Document/View Strategies
Document/View - When Not to Use It
Avoiding the Document/View Architecture
Playing Along with the Document/View Architecture
Tricks with Templates
Multiple Templates
Adding a New Item to your Window Menu
Two Views Automatically
Changing Views in an SDI Application
How MFC Reacts to Multiple Templates
What Frames are For
Status Bars and Toolbars
CStatusBar
CToolBar
Docking
Tool Tips
Summary
Chapter 5: Using Dialogs and Controls in MFC
User Interfaces: The Windows Way
Drawing Your Dialog
Requesters
Notifications
Modifiers
Developing a Dialog
Instantiating Your Dialog
CDialog
Modal Dialogs
Modeless Dialogs
Your Dialog Classes
Working with Controls in Your Dialog
Edit Controls
Edit Notifications
The Rich Edit Control
List Controls
Button Controls
Static Controls
Dialog Data Exchange
Data Exchange Code in Practice
Data Validation Code with DDV_
Using ClassWizard
Performing Cross-Edits
About Live Edits
Using Common Dialogs
File Save and Save As
File Open
Print
Font Browser
Color Chooser
Summary
Chapter 6: User Interface Issues
Developing Applications
The Problems with Application Development
The MFC Solution
Using Property Sheets
Creating Property Pages
Building a Property Sheet
Page Management Functions
Data Exchange in Property Sheets
Performing Special Validation
Using an Apply or Help Button
Property Pages as Wizards
Painting Your User Interface
Windows Object-oriented Programming
SelectObject() and Data Typing
The CDC Class and Device Contexts
CDC Functions
Metafiles
CFont
CPen
CBitmap
CBrush
CPalette
CRgn
Stock Objects
Splitter Windows
The Different Kinds of Splitters
Splitters and Performance
Summary
Chapter 7: Advanced User Interface Programming
Caveat
About CWnd
System Level Messages
CWnd's Interaction with CCmdTarget
Subclassing
Painting in Dialogs
Solving Non-System Font Problems
Coloring Your Controls
Modifying Common Dialogs
The Windows Common Dialog Templates
Explorer Style Boxes
Changing Behavior
Adding Controls
More Advanced Techniques
Cool Painting Tricks
When PreCreateWindow() isn't Enough
Small Title Bars
Dynamic and Pop-up Menus
Dynamically Creating a Menu
Building Menus out of CMenuEntrys
Letting MFC Know About Your Menu
Go Forth and Apply
The Gentle Art of Subclassing
Like School in the Summertime: No Class
Windows Subclassing
Subclassing MFC Objects
About Object-Oriented Design
Can You See My House from Here?
Summary
Chapter 8: Using the Windows Common Controls
Overview
Common Control Basics
Initializing the Common Controls Library
Notifications
Image Lists
Image Masks
List Views and Image Lists
Manipulating the Image List after Creation
The List View Control
Other List View Control Styles
Spin Button Control
Data Validation
Stand-alone Spin Controls
Slider Control
My Mouse Has Ticks
Data Exchange with Sliders
Progress Control
Animation Control
Playing a File
Animation Control Notification
The Tree View Control
ReadList()
Adding New Information
Tree View Styles
CTreeCtrl
The TV_ITEM Flags
Notifications
Other Population Methods
Fooling with Entries
Hot Key Control
Virtual Key Codes
Restricting Choices
Header Control
Painting
Freeing Memory
Tool Tip, Tool Bar and Status Bar Controls
Tab Controls
Handling Selections
Setting Drawing Parameters
Control-based Views
The Rich Text Edit Control
Character Formatting
Paragraph Formatting
Serializing a Rich Edit Control
Uncommon Controls
Checked List Boxes
CDragListBox
Summary
Chapter 9: Writing Programs for the Windows Shell
Working With the Shell
Shell APIs
The Shell Namespace
The Taskbar Notification Area
Summary
Chapter 10: Utility and Exception Classes
CStrings
Constructing CString Objects
CString Operators
CStrings and String Resources
Comparing Strings
Searching CStrings
Extracting the Contents of CString
CString Formatting
Working Directly with the Buffer
Using Normal String Functions
Empty Strings
CStrings and COM
Binary Data in CString
Dynamically Allocating CString Objects
Designing with CStrings
Efficiency
Data Structure Wrappers
Points
Comparing CPoints
Sizes
Rectangles
Handling Time Values
CTime
Performing Time Math
COleDateTime
The Year 2000
Exception Handling
Exceptions and MFC
MFC Macros vs. Standard Exception Handling
Win32 Structured Exception Handling
Collection Classes
The Type-safe Collection Classes
Lists
Arrays
Maps
Another Path to Type Safety
Files
CFile
CStdioFile
CMemFile
MFC and File Security
Sundry Stuff
Wait Cursors
Error Messages
Summary
Chapter 11: Writing Multithreaded Applications with MFC
What's a Thread, Anyway?
Thread Priorities
Switching Contexts
Processes vs. Threads
Applications for Multithreading
Times When You Shouldn't
Times When You Should
Threads and Message Loops
Applying Threads
Creating Threads
Your Own Threads
Worker Threads
Thread Synchronization
Critical Sections
Mutexes
Semaphores
Events
Other Waitable Objects
Threads and MFC
Threads and Objects
Debugging Multithreaded Applications
Some Notes About Processes
One Instance at a Time
Everything I Needed to Know About Threads, I Learned in Kindergarten
Summary
Chapter 12: Creating Dynamic-link Libraries
Libraries
Dynamic-link Libraries
Architectural Decisions
Initializing a DLL
Coding with DLLs
A Bit of History
Building A DLL
Easing the Build Process
Using Dynamic-link Libraries with C++
Name Mangling
Alternative Calling Conventions
Using and Writing DLLs with MFC
MFC DLL Models
Summary of DLL Models
About DLLApp
Troubleshooting DLL Projects
Debugging DLL Projects
Debug Information
DLL Tools
Getting Along with the Linker
Run-time Options
How the Linker Works
Summary
Chapter 13: Writing Database Applications
What is ODBC?
The ODBC Standard
What's ODBC For?
Just Say DAO
Jet Airliner, Don't Take Me Too Far Away
Creating Data Sources
System Data Sources
Programmatically Creating Data Sources
Other Interesting Settings
Your Environment
Data Definition Language Commands
CDatabase and CDaoDatabase
Opening DAO Databases
Connection Settings
SQL Commands Through CDatabase
Handling Transactions in ODBC
Problems with Transaction Processing
Transaction Processing in DAO
Using the ODBC API Directly
Using DAO Directly
CRecordset and CDaoRecordset
Record Field Exchange
Opening a Recordset
You Look Fetching!
Changing Your Recordset
Passing Parameters
Dynamic Recordsets
Other DAO Classes
What About AppWizard?
Tweaking an AppWizard Application
What Are CRecordViews?
The CRecordView's Dialog
Opening the Associated Recordset
Database Applications and Control Data
Notes About Performance Tuning
Tuning Your Database Machine
Tuning Your Database
About ODBC and Unicode
Comparing DAO and ODBC
Database Support
Efficiency
Data Sources vs. Databases
Summary
Chapter 14: Writing OLE Containers
Understanding OLE
Object, Object and Object
What Kind of Applications Can I Write with OLE?
OLE Applications and AppWizard
COM and Your System
Waking Up COM
Interfaces
Creating the Interfaces
What are Interfaces, Really?
About Embedded Objects
What's the Registry for?
A New CDocument
In-place Editing
Activation Patterns
Painting in an OLE Container
Positioning, Moving and Sizing Your Object
A COleRose is a CRose
Building a User Interface
Paint a Happy Face
The Size of It All
Activation
The Edit Menu
OLE and the Clipboard
Copying and Cutting OLE Objects
Links
Drag-and-drop
Getting Started with Drag-and-drop
Take a Drag
On the Clipboard
OnDragEnter()
OnDragOver()
OnDragLeave()
Don't Bogart that Object
Stunts with Drag-and-drop
Automation
How Does It Work?
Handling Character Types in OLE Applications
OLE Containers and the Document/View Architecture
Summary
Chapter 15: Writing OLE Servers
OLE Servers
Servers and Containers: Working in Perfect Harmony
Registration
Application Self-Registration
What Gets Registered?
Server Information
Keeping Track of Server Items
What is Active When?
Notes about Metafiles
Transitions
The In-Place Frame
Menu Negotiation
Updates
UpdateAllItems()
Verbs
Serialization
Serialize()
Beyond Active Documents
Translating Business Rules
What if I'm Not in Big Business, Smart Guy?
Automation
Prerequisites for Automation
Differences from Embedding
Implementing Automation in MFC
.ODLay Hee-Hoo!
About the Sample
Other OLE Applications
Debugging OLE Applications
Automation and ActiveX Controls
Custom COM Interfaces
The Rubber Hits the Road
Summary
Chapter 16: ActiveX Controls
Looking at the User Interface
The Birth of Custom Controls
Custom Controls: The Next Generation
The Fundamentals of ActiveX Controls
Controls at Run Time
Creating a Control Project
How Many Controls Would You Like?
Would You Like a Run-time License?
Would You Like Source Comments?
Would you Like Help Files to be Generated?
Activates When Visible
Invisible at Runtime
Show in "Insert Object" Dialog
About Box
Simple Frame
Subclassing a Control
Protecting the Innocent
What's in the Project?
COleControl
Properties
Stock Properties
Adding and Managing Properties
Storing and Loading the Properties
Property Pages
Adding Your Own Property Pages
Property Data Exchange
Ambient Properties
Methods
Events
Adding Events
Events with Parameters
Activations
Advanced Controls Issues
Writing Subclassed Controls
Handling Licensing in Your Control
Control Versioning
The State of the Module Address
Contracts and Obligations
Caveat Creator
Where Should I Put this Control?
Testing your Controls
Summary
Chapter 17: ActiveX Control Containers
Taking Credit for the Work of Others
Control Proxy Classes
Setting the Machinery in Motion
Static Containment
On a Silver Template
Breathing Life into the Proxy
Working with the Control
Dynamic Containment
The CreateControl() Function
Serializing Control Data
Focus and ActiveX controls
ActiveX controls and the Document/View Architecture
Showing Property Sheets
Rules for Using Controls
Summary
Chapter 18: Internet Client Programming
The Smallest Pieces
The World Wide Web
Client-Server and the Internet
Internet Clients and MFC
Finding Files
Addressing
What is HTTPS?
Other Client Strategies
Summary
Chapter 19: Internet Server Programming
No Atmosphere, but Good Service
Critical Government Interrogation
Internet Server Application Programming Interface
Filters
Server Extensions
Notes on MFC and the ISAPI Architecture
Going Further
Appendix A: Installing Visual C++
Visual C++ 5.0
Installation Options
Sample Source Code
Custom Installations
The Microsoft Foundation Classes and Template Libraries
Database Drivers
Tools
Books Online
Installation Directories
Registry Entries
Appendix B: International Programming
Internationalizing Your Project
Localizing Strings
International String Handling
Practical Preparations
Converting Existing Projects
Building the Application
Locale-specific Routines
Summary
Appendix C: Writing Console Applications
Building Your Console Application Project
Multithread-safe Applications
Precompiling Header Files
Choosing Header Files
Adding a CWinApp-derived Class
Performing I/O in Console Applications
When a Console isn't a Console
Using the Console Functions
Console Limitations
Caveats for Writing Console Applications
Summary
Appendix D: The Foundation Classes Headers and Libraries
Header Files
Appendix E: A History of MFC
You Kids Have It Easy
MFC 1.0
MFC 2.0
MFC 3.0
MFC 4.0 and 4.1
MFC 4.2
MFC 4.2b
MFC 4.21
评论4
最新资源