简介
Introduction
Foreword
About the Author
Core MFC
The MFC Architecture
A Brief History of MFC
The MFC Class Hierarchy
CObject
CCmdTarget
CWinThread
CWinApp
CWnd
CFrameWnd
CView
CDocument
Summary
MFC Dialogs, Controls, and Data Interaction
Creating an Application
Starting and Using MFC AppWizard
The AppWizard-Generated Code
Modifying the Application
Adding Dialog Controls
Adding Initialization
Using Dialog Controls
ToolTips
Enabling ToolTips
Displaying Text
Dialog Data Exchange
Standard DDX
UpdateData
Using Standard Dialog Boxes
File Open/Save
Color Selector
Font Selector
Print Dialog
Summary
The Windows Common Controls
Initializing and Using the Common Controls
Notifications for Windows Common Controls
The Notification Message Structure
Overview of the Notification Process
A Better Notification Handling Scheme
Specifying Notification Ranges with ON_NOTIFY_RANGE
Hot Key Controls: Class CHotKeyCtrl
CHotKeyCtrl Class Methods
Creating and Initializing a CHotKeyCtrl Object
Using a Hot Key Control
Spin Controls: Class CSpinButtonCtrl
Spin Control Styles
CSpinButtonCtrl Messages
CSpinButtonCtrl Class Methods
Creating and Initializing a Spin Control
Sample Program: SPIN1
Slider Controls: Class CSliderCtrl
Slider Control Styles
CSliderCtrl Messages
CSliderCtrl Class Methods
Creating and Initializing a Slider Control
Sample Program: Slider Controls (SLIDER1)
Sample Program: SLIDER1
Progress Bar Controls: Class CProgressCtrl
CProgressCtrl Class Methods
Creating and Initializing a CProgressCtrl Object
Using a Progress Control
Image Lists: Class CImageList
CImageList Class Methods
Creating and Initializing a CImageList Control
List View Controls: Class CListCtrl
List View Control Styles
Image Lists and the List View Control
List View Items and Subitems
List View Notification Messages
Creating and Initializing a CListCtrl Object
Using the List View Control
Tree View Controls: Class CTreeCtrl
Tree View Control Styles
Tree View Notification Messages
CTreeCtrl Class Methods
Creating and Initializing a Tree View Control
Using a CTreeCtrl Object
Sample Program: TREELIST.EXE
Tab Controls: Class CTabCtrl
Tab Control Styles
Tab Control Notification Messages
CTabCtrl Class Methods
The Tab Item Structure (TC_ITEM)
Creating and Initializing a Tab Control
Using a Tab Control
Animate Controls: Class CAnimateCtrl
Animate Control Styles
Animate Control Notification Messages
CAnimateCtrl Class Methods
Creating and Initializing an Animate Control
Using an Animate Control
Rich Edit Controls: Class CRichEditCtrl
Rich Edit Control Window Styles
The Character Format Structure (CHARFORMAT)
The Paragraph Format Structure (PARAFORMAT)
CRichEditCtrl Class Methods
CRichEditCtrl Line-Related Methods
CRichEditCtrl Text-Selection Methods
CRichEditCtrl Formatting Methods
CRichEditCtrl Editing Methods
CRichEditCtrl Clipboard Methods
CRichEditCtrl General-Purpose Methods
Creating and Initializing a Rich Edit Control
Using a Rich Edit Control
Summary
Painting, Device Contexts, Bitmaps, and Fonts
Device Contexts
The Graphics Device Interface
MFC Wrapping
MFC Device Context Classes
The Base Class: CDC
Painting with Class CPaintDC
Managing Client Areas with Class CClientDC
Managing Frame Windows with Class CWindowDC
Windows Graphic Objects
Pens: Class CPen
Brushes: Class CBrush
Fonts: Class CFont
Bitmaps: Class CBitmap
Palettes: Class CPalette
Regions: Class CRgn
GDI Coordinate Systems
Logical Mapping Modes
Vector Graphics
Drawing Modes
Lines and Polylines
Rectangles
Regions
Polygons
Ellipses
Bezier Curves
Fonts and Text
Font Characteristics
The TEXTMETRIC Structure
The LOGFONT Structure
Font Creation
Drawing Text
Sample Program: Vector Graphics and Text Methods (VECTEXT1.EXE)
Raster Graphics
Named Raster Operations (ROPs)
Bitmaps
Device-Dependent Bitmaps
Device-Independent Bitmaps (DIBs)
The CBitmap Class
Transferring and Contorting Bitmaps
Bitmap Resources
Tacking Resources onto an Executable File
Getting Image Resources out of an Executable File
Sample Program: Exploring Bitmap Resources (BITMAP1)
Summary
Custom Control Development
Window Classes Versus C++ Classes
A Validating Edit Control
The Clock Static Control
Control Metrics
Painting the Face
Locating the Hands
Painting the Hands
Setting the Time
Pitfalls of Subclassing Standard Controls
The Hyperlink Control
Implementation Strategy
Font Processing
Painting the Window
Controlling the Cursor
Mouse Input
Keyboard Input
Launching the Link
Advanced Custom Control Topics
Subclassing Limitations
Notifications
Using the Resource Editor with Custom Classes
Summary
The MFC Application Object, Message Routing, and Idle Processing
The MFC Application Object
CWinApp and Application Lifetime
The CWinApp Data Members
The CWinApp Member Functions
Application-Specific Initialization
Functionality in InitInstance
OLE Container Support
3D Look for Windows NT 3.5x
Registry Usage
Most Recently Used Files List
SDI and MDI Document/View
Main Frame Window Creation
Automation Support
Rich Edit Control Support
Command-Line Handling
Message Routing, Message Maps, and Message Categories
Message Routing
PreTranslateMessage
Message Maps
Idle Processing
OnIdle
Idle Processing for Dialogs
The Splash Screen Component
Summary
Documents, Views, and Applications That Use Them
The Document/View Architecture
Documents, Frames, and Views
Document Templates
Creating New Documents
Opening New Files
Single Versus Multiple Document Templates
Views
The CView Class
The CScrollView Class
The CFormView Class
The Database View Classes
The Control Views
Changing Views in an SDI
Using the MDI
Summary
Extending the User Interface
Responding to the User
Keyboard Messaging
Handling Keyboard Messages
Mouse Messaging
Handling Mouse Messages
User Interfaces and AppWizard
Extending Menus
Obtaining Menus and Pop-up Menus
Adding Menu Items
Using Floating Pop-up Menus
Putting Control Bars to Use
Using Toolbars and Rebars
Using Status Bars
Showing and Hiding Control Bars
Supporting ToolTips
Updating the User Interface
Property Sheets and Wizards
MFC's Support for Property Sheets and Wizards
Creating a Simple Wizard
Splitting a View
Summary
Printing
Printing Fundamentals
Printing with MFC
Printing in the View
The PrintInfo Object
Printing Menu Commands
Printing and GDI Mapping Modes
WYSIWYG Printing
Application Resources
The Application Class
The View Class
Pagination
Printing with a Known Page Count
Printing with an Unknown Page Count
Printing Page Numbers
Stopping and Aborting Print Jobs
Halting a Print Job in OnPrepareDC()
Halting a Print Job in OnPrint()
Summary
MFC and COM Programming
COM
A Little History
Interfaces, Objects, and Methods
Some Terminology
A Real-World View
The IUnknown Interface
Servers, Clients, and Classes
The COM Runtime Environment
Defining the Class Factory
How Are COM Objects Reused?
Marshaling and Threading
Marshaling
Threading
COM, OLE, and Automation
IDispatch
Automation Servers, Objects, and Controllers
Supporting Both IDispatch and IUnknown
Persisting COM Data
Structured Storage
Identifying COM Data (Monikers)
Transferring Data
Uniform Data Transfer
Connectable Objects
DCOM
Object Creation
Invoking Methods
Security Issues
Some Important Information
BSTR
SAFEARRAY
HRESULT
VARIANT
Further Reading
Summary
COM and MFC
Understanding the Afx Global Functions
Application Lifetime Control
Client Control Management
Connection Point Management
Control Registration
Exceptions
Initialization
Licensing
Type Information
Reviewing the OLE Macros
Class Factories
Client/Container Common Commands
Control Property Persistence
Dialog Data Exchange
Dispatch Maps
Event Maps
Property Page Data Mapping
Property Pages
Type Library Access
MFC and the OLE Class Categories
Active Document
Automation
Common Dialogs for OLE
Container
Control
Drag and Drop (Universal Data Transfer)
Document Servers
Support
Summary
MFC OLE Servers
Document Servers
Server Types
Full Server
Active Document
Container/Server
Mini-Server
Document Server Design
OLE Documents
Active Documents
Building an Active Document Server
Persistence
Rendering the View
Automation Servers
IDispatch
GetIDsOfNames
GetTypeInfo
GetTypeInfoCount
Invoke
IDispatch-Derived Interface in ODL
Calling Methods Through IDispatch
GetIDsOfNames
Type Information Methods
Invoke
Dispinterfaces Differ from Interfaces
Calling Methods Through IDispatch
Dual Interfaces
The Variant
An Automation Server Using MFC
Server Type
Declaring and Defining Additional Dispinterfaces
Adding Methods and Properties
Summary
MFC OLE Clients
IDispatch and Its Place in Automation
Interface Definition for Automation Servers
IDL and ATL
ODL and MFC
Dual Interfaces
MFC and Automation
Controller
Connecting to a Server
Server Review
Building a Controller
Using COleDispatchDriver
Using #import
Remote Automation
Summary
MFC ActiveX Controls
Development Strategy
MFC
ATL
MFC and ATL
Control Development
Two Faces of a Control
Runtime
Design Time
Subclassing a Control
MFC
ATL
Component Categories
ICatRegister
ICatInformation
Methods, Properties, and Events
Properties
Methods
Events
Property Pages
Property Pages in ATL
Property Pages in MFC
Component Registration
Registration Scripts
Registration and Controls
COM Object Subkeys
Building an MFC Control
Interface Definition
A Quick ATL Port
Summary
MFC ActiveX Control Containers
Active Document Container
Storage
Site Objects
In-Place Activation
Document Extensions
Building the Simplest Active Document Container
OLE Controls
Adding Containment to an Existing Project
ActiveX Container
Control Containment and Events
Summary
Using MFC and ATL
What Is ATL and Why Is It Important for Programming in MFC?
Helpful ATL COM Support for MFC Applications
COM Pointers the Smart Way
Other ATL COM Support
Advanced ATL Support for MFC Applications
Begin with Your MFC Application
Add the Required ATL Support
Summary
Scripting Your MFC Application
Scripting Basics
Scripting Interfaces
Dual Interfaces
Object Models
Implementing a Scripted Application
Object Implementation
Summary
MFC Database Programming
MFC Database Processing
Relational Database Concepts
Tables
Columns
Records
Cursors
Transactions
Storing and Retrieving Data
SELECT
INSERT
DELETE
UPDATE
Database Communication Mechanisms
ODBC
DAO
Which Methodology Should I Use?
ODBC/MFC
CDatabase
CRecordset
DAO
CDaoWorkspace
CDaoDatabase
CDaoRecordset
CDaoTableDef
CDaoQueryDef
Summary
Advanced Database Support
The COM Approach
OLE DB
ADO
Which One Should I Use?
OLE DB Consumers Using the ATL Wrapper Classes
CDataSource
CSession
Accessors
Rowsets
Accessing Datasource Data
Using the ADO C++ Interfaces
ADOConnection
ADORecordset
ADOCommand
ADOField
ADOProperty
ADOParameter
ADOError
Summary
MFC Utility Classes
Strings and Collections
Strings and String Classes
Inside the CString Class
Practical CString Usage
CString Summary
Collections
Inside Collection Classes
Templated Collections
The UNL_MultiEd Application
Overview
An STL Approach
Summary
File I/O and MFC
The CFile Class
Processing Files with CFile
Inside the CFile Class
The CStdioFile Class
The CMemFile Class
The CSharedFile Class
The CFileDialog Class
The User-Defined CFileDialog Class
Practical Usage of CFile and CFileDialog
Opening a File
Reading Data from a File
A Classical Approach
What Are Streams?
Summary
Exceptions
What Are They Good For?
Types of Exceptions
Structured Exception Handlers
Nesting of Structured Exception Handlers
Raising Structured Exceptions
Cleaning Up After an Exception
C++ Exceptions
Defining a C++ Exception Class
MFC Exceptions
MFC CException-Derived Classes
CMemoryException
CNotSupportedException
CArchiveException
CFileException
CResourceException
COleException
CDbException
COleDispatchException
CUserException
CDaoException
CInternetException
Deriving Your Own MFC-Compliant Exception Objects
Deleting Exceptions
Using MFC Exception Macros
Mixing Exceptions
Summary
MFC and the Web
MFC and DHTML
DHTML, MSIE, and the Internet
Using the Internet Explorer Web ActiveX Control
Internet Explorer ActiveX Control Basics
CHtmlView
CHtmlView and the Document/View Relationship
CHtmlView and COM
Using the Internet Explorer ActiveX Control in a Dialog Box
Using DHTML
The DHTML Object Model
The Document Object
Other DHTML Objects
Collection Objects
DHTML COM Interfaces
Obtaining the Document DHTML Interface
Obtaining the DHTML Collections Interfaces
Using the DHTML Interface
The DHTML Element Interface Methods
Document Navigation
Summary
CSocket Programming
How Do Network Communications Work?
Sockets, Ports, and Addresses
Winsock and MFC
Initializing the Winsock Environment
Creating a Socket
Making a Connection
Sending and Receiving Messages
Closing the Connection
Socket Events
Controlling Event Triggering
Detecting Errors
Getting Socket Information
Sockets and I/O Serialization
Building a Networked Application
Creating the Application Shell
Window Layout and Startup Functionality
Inheriting from the CAsyncSocket Class
Connecting the Application
Sending and Receiving
Ending the Connection
Summary
WinInet Programming
Web Application Protocols and WinInet
Hypertext Transfer Protocol
File Transfer Protocol
Gopher Protocol
WinInet API and MFC
Internet Session Basics
CInternetSession
CInternetFile
CInternetException
CInternetConnection
Building a Simple WinInet Application
Application-Level Functionality
HTTP Classes
FTP Classes
Gopher Classes
Building a Simple FTP Client
Summary
ISAPI Extensions
The Foundation
From There to Here
From GET to POST
Adding Some Form Elements
Change the Form
Change the Parse Map
Declare and Use the Handler Function
Add a Radio Button
Other Form Input Elements
Change the Form
Change the Parse Map
Change the Handler Function
Summary
MAPI and MFC
The Messaging Application Programming Interface
Client Applications
Two Higher-Level Alternatives: Simple MAPI and CMC
Simple MAPI
Common Messaging Calls
The MapiMessage Structure
The MapiFileDesc Structure
Limited MAPI Functionality in MFC
The CDocument Connection
Doing MAPI the MFC Way
The CDocument::OnFileSendMail() Method
Sample Program: MAPI1.EXE
Summary
TAPE and MFC
Overview
Assisted Telephony
Basic Telephony Service
Supplemental Telephony Service
Extended Telephony Service
History of TAPI
TAPI 1.3
TAPI 1.4
TAPI 1.5
TAPI 2
TAPI 2.1
TAPI 2.2
TAPI 3
Using Assisted Telephony
Using Basic Telephony
Configuring TAPI
Connecting with TAPI
Transmitting Data with TAPI
Disconnection with TAPI
Terminating a TAPI Session
Summary
MFC and Graphics Programming
MFC and OpenGL
What Is OpenGL?
Graphics Boot Camp
Core Terms and Key Concepts
The Basic Mathematics of Graphics Programming
OpenGL Boot Camp
OpenGL Datatypes
OpenGL Function Naming Conventions
OpenGL Render Function Scoping
The OpenGL Matrix Stack
The OpenGL Rendering Context
Minimal OpenGL Program and a Custom View
Creating Your Basic MFC Application
Adding the Custom OpenGL Base Class
Integrate the Custom View Class into Your Application
Build Your 3D Scene
Add the OpenGL Libraries to Your Project抯 Link List
2D and 3D Models
Basic Model Development
Model Transformations
Display Lists
Light
The Basics of Light in OpenGL
Types of Light
Object Material Properties
Texture Mapping
OpenGL Images and Windows Device-Independent Bitmaps
Applying Texture
Special Effects
Blending
Fog
Summary
MFC and DirectX
What Is DirectX?
DirectX in a Nutshell
DirectX Components
DirectX Basics
Differences in COM Programming Style and DirectX
DirectX Component Startup Sequence
DirectDraw Basics
Initializing DirectDraw
DirectDraw and Palettes
DirectDraw Surfaces
DirectDraw Page Flipping
DirectDraw from a Window
Using DirectDraw in Practice
Surfaces and Bitmaps
Windowed Rendering
Error Handling
DirectDraw Shutdown
Summary
Multimedia and MFC
Multimedia Fundamentals
The DirectX Media Player Control
Media Formats Supported by the Media Player Control
Inside the Media Player Control
The CMediaPlayer Class
Using the Media Player Control
Playing Sound
Working with Waves
Revisiting DirectSound
Using DirectSound to Play Sound Effects
Summary
Advanced MFC
Inside the Registry
Registry Usage
Configuration
Services Information
State
User Preferences
The Registry Structure
Programmatic Control of the Registry
The Registry API
The Registry Sample Application
The Registry Key Editor Dialog
Creating a New Key
Deleting a Key
Deleting a Name/Value Pair
A Word About Wrapping the Registry Functions
A Word About Installation
Summary
Writing and Using DLLs
Advantages of DLLs
Code Elimination
Modularity and Packaging
Extensibility
Inside an AFX DLL
Exporting Classes, Functions, and Data
The Big Deal About Exports
Mangled Names
Exporting Classes
What Goes Around, Comes Around
Exporting Explicit Functions
Exporting Data
Exporting MFC Data
Exporting the Destructor
Export Toolkit include Files
What to Export
Other DLL Issues
AfxLoadLibrary and AfxFreeLibrary
Designing for Extensibility and Reuse
Resource Location
Multiple Module Definition Files
Load Addresses and the Linker
Summary
Creating Custom Wizards
Property Sheets and Property Pages
The CPropertySheet and CPropertyPage Classes
The Wizard Walk and the Property Sheet Connection
Creating a Wizard
Setting the Wizard Mode
Enabling the Wizard Buttons
Displaying the Wizard
Wizard Notification Messages
Sample Program: Off to See the Wizard (WIZARD1.EXE)
Creating Wizard Page Dialog Template Resources
Create a Dialog Class for Each Dialog Resource
Exploring the Welcome Page: Class CIntroPage
Exploring the About You Page: Class CPage1
Updating Wizard Information for CPage2 and CPage3
Creating and Displaying the Wizard
Summary
Index
目录
目 录译者序
前言
第一部分 mfc概述
第1章 mfc的结构 1
1.1 mfc的发展简史 1
1.2 mfc类的层次结构 4
1.2.1 cobject 4
1.2.2 ccmdtarget 8
1.2.3 cwinthread 11
1.2.4 cwinapp 14
1.2.5 cwnd 18
1.2.6 cframewnd 23
1.2.7 cview 24
1.2.8 cdocument 25
1.3 小结 27
第2章 mfc对话框、控件和数据的
交互操作 29
2.1 创建应用程序 29
2.1.1 启动和使用mfc appwizard 29
2.1.2 appwizard生成的代码 31
.2.2 修改应用程序 33
2.2.1 添加对话框控件 33
2.2.2 添加初始化信息 38
2.2.3 使用对话框控件 39
2.3 工具提示 40
2.3.1 激活工具提示 41
2.3.2 显示工具提示文本 41
2.4 对话框数据交换 42
2.4.1 标准ddx 42
2.4.2 updatedata 42
2.5 使用标准对话框 43
2.5.1 文件打开/保存对话框 43
2.5.2 颜色选择对话框 43
2.5.3 字体选择对话框 44
2.5.4 打印配置对话框 44
2.6 小结 45
第3章 windows的常用控件 46
3.1 常用控件的初始化和用法 46
3.2 用于windows常用控件的通知 47
3.2.1 通知消息的结构 47
3.2.2 通知进程概述 48
3.2.3 更好的通知消息处理方案 48
3.2.4 用on_notify_range
设定通知范围 49
3.3 热键控件:chotkeyctrl类 49
3.3.1 chotkeyctrl类的方法 50
3.2.2 创建chotkeyctrl对象并
对它进行初始化 50
3.3.3 使用热键控件 50
3.4 微调控件:cspinbuttonctrl类 51
3.4.1 微调控件的样式 52
3.4.2 cspinbuttoncrtl消息 52
3.4.3 cspinbuttonctrl类的方法 52
3.4.4 创建微控件并对它初始化 53
3.4.5 示例程序:spin 1 53
3.5 滑块控件:csliderctrl 56
3.5.1 滑块控件的样式 56
3.5.2 csliderctrl消息 57
3.5.3 csliderctrl类的方法 58
3.5.4 创建滑块控件并对它进行
初始化 59
3.5.5 滑块控件的示例程序slider1 60
3.5.6 示例程序slider1 61
3.6 进度栏控件:cprogressctrl类 63
3.6.1 cprogressctrl类的方法 63
3.6.2 创建cprogressctrl对象并对它
初始化 64
3.6.3 使用进度栏控件 64
3.7 图形列表:cimagelist类 65
3.7.1 cimagelist类的方法 65
3.7.2 创建cimagelist控件并对它
初始化 66
3.8 列表视图控件:clistctrl类 67
3.8.1 列表视图控件的样式 68
3.8.2 图形列表与列表视图控件 69
3.9 列表视图项目和子项目 69
3.9.1 列表视图通知消息 70
3.9.2 创建clistctrl对象并对它
进行初始化 71
3.9.3 使用列表视图控件 71
3.10 树状视图控件:ctreectrl类 73
3.10.1 树状视图控件的样式 73
3.10.2 树状视图通知消息 74
3.10.3 ctreectrl类的方法 74
3.10.4 创建树状视图控件并对它
进行初始化 75
3.10.5 使用ctreectrl对象 76
3.10.6 示例程序treelist.exe 76
3.11 选项卡控件:ctabctrl类 77
3.11.1 选项卡控件的样式 77
3.11.2 选项卡控件的通知消息 78
3.11.3 ctabctrl类的方法 78
3.11.4 选项卡项目的代码结构 79
3.11.5 创建选项卡控件 79
3.11.6 使用选项卡控件 80
3.12 动画控件:canimatectrl类 81
3.12.1 动画控件的样式 82
3.12.2 动画控件的通知消息 82
3.12.3 canimatectrl类的方法 82
3.12.4 创建动画控件 83
3.12.5 使用动画控件 83
3.13 多信息文本编辑控件:
cricheditctrl类 83
3.13.1 多信息文本编辑控件的
窗口样式 85
3.13.2 字符格式的结构 85
3.13.3 段落格式的结构 86
3.13.4 cricheditctrl类的方法 87
3.13.5 cricheditctrl与文本相关
的方法 88
3.13.6 cricheditctrl的文本选定方法 88
3.13.7 cricheditctrl的文本格式化
方法 88
3.13.8 cricheditctrl的编辑方法 89
3.13.9 cricheditctrl的剪贴板方法 89
3.13.10 cricheditctrl的通用方法 89
3.13.11 创建多动能编辑控件 90
3.13.12 使用多信息文本编辑控件 90
3.14 小结 91
第4章 画图、设备环境、位图与字体 92
4.1 设备环境 92
4.2 图形设备界面 92
4.3 mfc设备环境的类 93
4.3.1 基类cdc 94
4.3.2 使用cpaintdc类进行绘图 95
4.3.3 用cclientdc类管理客户
程序区域 97
4.3.4 用cwindowdc类管理图
文框窗口 98
4.4 windows的图形对象 99
4.4.1 画笔:cpen类 100
4.4.2 画刷:cbrush类 101
4.4.3 字体:cfont类 102
4.4.4 位图:cbitmap类 102
4.4.5 调色板:cpalette类 102
4.4.6 区域:crgn类 102
4.5 gdi坐标系 103
4.6 矢量图形 104
4.6.1 绘图模式 105
4.6.2 线条与折线 107
4.6.3 矩形 110
4.6.4 区域 112
4.6.5 多边形 113
4.6.6 椭圆 113
4.6.7 贝济埃曲线 115
4.7 字体与文本 117
4.7.1 字体特征 117
4.7.2 textmetric 结构 118
4.7.3 logfont结构 120
4.7.4 创建字体 121
4.7.5 绘制文本 123
4.8 示例程序:矢量图形和文本方法 124
4.9 光栅图形 125
4.9.1 有名的光栅操作 125
4.9.2 位图 125
4.9.3 随设备而定的位图 126
4.9.4 不受设备限制的位图 127
4.9.5 cbitmap类 127
4.9.6 传送和伸展位图 128
4.10 位图资源 129
4.10.1 资源附加给可执行文件 129
4.10.2 从可执行文件中获取图形资源 130
4.11 示例程序:介绍位图资源 131
4.12 小结 134
第5章 创建自定义控件 136
5.1 windows类与c++类 136
5.2 用于核实信息的编辑控件 137
5.3 时钟静态控件 138
5.3.1 控件的规格 139
5.3.2 画钟面 140
5.3.3 确定指针的位置 141
5.3.4 画指针 142
5.3.5 设置时间 143
5.3.6 建立标准控件的子类时
出现的向题 144
5.4 超级链接控件 144
5.4.1 实现方法 146
5.4.2 字体的处理 147
5.4.3 画窗口 148
5.4.4 控制光标 149
5.4.5 鼠标输入 150
5.4.6 键盘输入 152
5.4.7 运行超级链接 153
5.5 高级自定义控件 154
5.5.1 建立子类时的局限性 154
5.5.2 通知消息 155
5.5.3 将资源编辑器用于自定义类 156
5.6 小结 156
第6章 mfc应用程序对象、消息的
传送和空闲处理 157
6.1 mfc应用程序对象 157
6.1.1 cwinapp和应用程序的寿命 158
6.1.2 cwinapp数据成员 159
6.1.3 cwinapp的成员函数 162
6.1.4 initinstance—特定应用程序的
初始化 162
6.1.5 initinstance中的函数 165
6.1.6 对ole容器的支持 165
6.1.7 windows nt 3.5的3d外观 165
6.1.8 注册表的使用 166
6.1.9 最近使用的文件列表 166
6.1.10 sdi和mdi文档/视图 166
6.1.11 创建主图文框窗口 167
6.1.12 支持automation 167
6.1.13 支持多信息文本编辑控件 168
6.1.14 命令行的处理 168
6.2 消息传送、消息表和消息类别 169
6.2.1 消息传送 169
6.2.2 消息表 171
6.3 空闲处理 173
6.3.1 onidle 173
6.3.2 为对话框进行空闲处理 175
6.4 闪现屏幕组件 176
6.5 小结 177
第二部分 文档、视图和使用它们
的应用程序
第7章 文档/视图的结构 179
7.1 文档、图文框和视图 179
7.2 创建新文档 181
7.2.1 打开新文件 183
7.2.2 单个文档模板与多个文档模板 185
7.3 视图 185
7.3.1 cview类 185
7.3.2 cscrollview类 185
7.3.3 cformview类 186
7.3.4 数据库视图类 186
7.3.5 控件视图 186
7.3.6 改变sdi中的视图 189
7.3.7 使用mdi 193
7.4 小结 195
第8章 扩展用户界面 196
8.1 响应用户的输入 196
8.1.1 键盘消息 196
8.1.2 处理键盘消息 197
8.1.3 鼠标消息 198
8.1.4 处理鼠标消息 200
8.2 用户界面与appwizard 201
8.3 扩展菜单 202
8.3.1 获取菜单和弹出式菜单 202
8.3.2 增加菜单项 202
8.3.3 使用浮动的弹出式菜单 203
8.4 将控件栏投入使用 204
8.4.1 使用工具栏和复合工具栏 205
8.4.2 使用状态栏 208
8.4.3 显示和隐藏控件栏 209
8.4.4 支持工具提示 210
8.5 更新用户界面 211
8.6 属性表和向导 212
8.6.1 mfc对属性表和向导的
支持特性 213
8.6.2 创建简单的向导 215
8.7 分割视图 223
8.8 小结 224
第9章 打印 225
9.1 打印的基本概念 225
9.2 用mfc进行打印 225
9.2.1 在视图中打印 226
9.2.2 cprintinfo对象 227
9.2.3 打印菜单命令 228
9.3 打印与gdi映像模式 229
9.4 所见即所得的打印方式 230
9.4.1 应用程序的资源 230
9.4.2 应用程序类 232
9.4.3 视图类 232
9.5 文档的分页 236
9.5.1 在页数已知的情况下打印文档 236
9.5.2 在页数未知的情况下打印文档 237
9.5.3 打印页号 238
9.6 停止和取消打印作业 239
9.6.1 用onpreparedc ()函数停止
打印作业 239
9.6.2 用onprint ()函数停止打印作业 240
9.7 小结 240
第三部分 mfc和com编程
第10章 com 241
10.1 发展历史 241
10.2 接口、对象与方法 242
10.2.1 一些术语的说明 242
10.2.2 介绍一个实际的例子 243
10.2.3 iunknown接口 243
10.3 服务程序、客户程序与类 246
10.4 com运行期的环境 247
10.4.1 定义类工厂 247
10.4.2 com对象如何重复使用 248
10.5 排列与线程 248
10.5.1 排列 249
10.5.2 线程 250
10.6 com、ole和自动化 251
10.6.1 idispatch 251
10.6.2 自动化服务程序、对象和
控制程序 253
10.6.3 同时支持idispatch和iunknown 253
10.7 永久性com数据 253
10.8 标识com数据 255
10.9 传送数据 255
10.9.1 统一数据传送 256
10.9.2 可连接的对象 256
10.10 dcom 257
10.10.1 对象的创建 257
10.10.2 调用方法 259
10.10.3 安全问题 260
10.11 一些重要的信息 260
10.11.1 bstr 260
10.11.2 safearray 261
10.11.3 hresult 261
10.11.4 variant 262
10.12 其他参考书目 262
10.13 小结 262
第11章 com和mfc 263
11.1 了解afx全局函数 263
11.1.1 应用程序寿命的控制 263
11.1.2 客户程序控件的管理 266
11.1.3 连接点的管理 266
11.1.4 控件的注册 268
11.1.5 异常情况 269
11.1.6 初始化 269
11.1.7 许可权 270
11.1.8 类型信息 270
11.2 关于ole宏 271
11.2.1 类工厂 271
11.2.2 客户程序/容器常用的命令 271
11.2.3 控件属性的持久性 272
11.2.4 对话框数据交换 273
11.2.5 调度表 274
11.2.6 事件表 275
11.2.7 属性页数据表 278
11.2.8 属性页 278
11.2.9 类型库的访问 279
11.3 mfc和ole类的类别 279
11.3.1 活动文档 279
11.3.2 自动化 280
11.3.3 ole的常用对话框 281
11.3.4 容器 282
11.3.5 控件 284
11.3.6 拖曳和放置 285
11.3.7 文档服务程序 286
11.3.8 支持 287
11.4 小结 288
第12章 mfc ole 服务程序 289
12.1 文档服务程序 289
12.2 服务程序的类型 289
12.2.1 完整的服务程序 290
12.2.2 活动文档 290
12.2.3 容器/服务程序 290
12.2.4 小型服务程序 290
12.3 文档服务程序的设计 290
12.3.1 ole文档 291
12.3.2 活动文档 294
12.4 建立一个活动文档服务程序 298
12.4.1 一致性 298
12.4.2 显示视图 299
12.5 自动化服务程序 300
12.6 idispatch 301
12.7 odl中的idispatch派生接口 302
12.8 通过idispatch调用方法 303
12.8.1 getidsofnames 303
12.8.2 类型信息的方法 304
12.8.3 invoke 304
12.9 调度接口与普通接口不同 304
12.10 通过idispatch访问c++中的
自动化服务程序 305
12.11 双重接口 305
12.12 变码 306
12.13 使用mfc的自动化服务程序 308
12.13.1 服务程序的类型 308
12.13.2 声明和定义更多的调度接口 311
12.13.3 添加方法和属性 311
12.14 小结 313
第13章 mfc ole 客户程序 314
13.1 idispatch和它在自动化中的作用 314
13.2 自动化服务程序的接口定义 314
13.2.1 idl与atl 315
13.2.2 odl与mfc 316
13.2.3 双重接口 317
13.3 mfc与自动化 318
13.3.1 控制器 318
13.3.2 连接到服务程序 319
13.3.3 服务程序的回顾 321
13.4 创建控制器 321
13.4.1 使用coledispatchdriver 321
13.4.2 使用# import 325
13.4.3 远程自动化 332
13.5 小结 335
第14章 mfc activex控件 336
14.1 开发策略 336
14.1.1 mfc 336
14.1.2 atl 337
14.1.3 mfc与atl 337
14.2 控件开发 338
14.3 控件的两个方面 340
14.3.1 运行时 340
14.3.2 设计时 340
14.4 建立控件的子类 340
14.4.1 mfc 340
14.4.2 atl 341
14.5 组件类别 341
14.5.1 icatregister 342
14.5.2 icatinformation 342
14.6 方法、属性和事件 342
14.6.1 属性 342
14.6.2 方法 344
14.6.3 事件 344
14.7 属性页 346
14.8 组件注册 347
14.9 com对象子关键字 348
14.10 建立一个mfc控件 349
14.11 接口定义 351
14.12 一个快速atl移植 358
14.13 小结 362
第15章 mfc activex控件容器 363
15.1 活动文档容器 363
15.1.1 存储区 364
15.1.2 现场对象 365
15.1.3 原地激活 365
15.1.4 文档扩展 367
15.1.5 建立最简单的活动文档容器 367
15.2 ole控件 368
15.2.1 对已有项目添加包容 369
15.2.2 activex容器 369
15.2.3 控件包容和事件 375
15.3 小结 380
第16章 使用mfc和atl 381
16.1 什么是atl,为什么atl在mfc
编程中很重要 381
16.2 对mfc应用程序有帮助的atl com
支持 381
16.2.1 com指针 381
16.2.2 其他atl com支持 383
16.3 对mfc应用程序的高级atl支持 390
16.3.1 开始做mfc应用程序 390
16.3.2 添加所需要的atl支持 390
16.3.3 自动建立atl com支持代码 391
16.3.4 检查添加到mfc应用程序中
的atl代码 394
16.3.5 添加另外的atl com支撑文件 400
16.3.6 修改项目设置 401
16.3.7 建立客户端应用程序 401
16.4 小结 403
第17章 用脚本语言编写mfc程序 404
17.1 脚本编程基础 404
17.1.1 脚本编程接口 405
17.1.2 对偶接口 409
17.2 对象模型 411
17.3 实现一个脚本编程的程序 412
17.4 小结 421
第四部分 mfc数据库编程
第18章 mfc数据库处理 423
18.1 关系数据库概念 423
18.2 存储和检索数据 425
18.3 数据库通信机制 427
18.4 odbc/mfc 428
18.4.1 cdatabase 428
18.4.2 crecordset 429
18.5 dao 436
18.5.1 cdaoworkspace 436
18.5.2 cdaodatabase 437
18.5.3 cdaorecordset 438
18.5.4 cdaotabledef 438
18.5.5 cdaoquerydef 439
18.6 小结 440
第19章 高级数据库支持 441
19.1 数据存取的com途径 441
19.2 ole db消费者使用atl包装类 441
19.2.1 cdatasource 445
19.2.2 csession 446
19.2.3 存取器 447
19.2.4 行集 451
19.2.5 存取数据源的数据 454
19.3 使用ado c++接口 456
19.3.1 adoconnection 461
19.3.2 错误 463
19.3.3 adorecordset 463
19.3.4 adocommand 465
19.3.5 adofield 467
19.3.6 adoproperty 468
19.3.7 adoparameter 468
19.3.8 adoerror 469
19.4 小结 469
第五部分 mfc实用程序类
第20章 字符串和集合 471
20.1 字符串和字符串类 471
20.1.1 cstring类内情 471
20.1.2 字符串分配 472
20.1.3 某些cstring函数 474
20.1.4 cstring实际用法 476
20.1.5 cstring小结 478
20.2 集合 478
20.2.1 集合类内情 478
20.2.2 模板化集合 483
20.3 unl_multied应用程序 484
20.4 一种stl方法 488
20.5 总结 488
第21章 文件输入输出和mfc 489
21.1 cfile类 489
21.2 cfile类内情 491
21.2.1 cstdiofile类 494
21.2.2 cmemfile类 496
21.2.3 csharedfile类 497
21.3 cfiledialog类 497
21.4 用户定义的cfiledialog类 499
21.5 cfile和cfiledialog的实际使用 500
21.5.1 打开文件 500
21.5.2 从文件中读数据 502
21.6 一种传统的途径 504
21.7 小结 505
第22章 异常处理技术 506
22.1 异常处理的用法 506
22.2 异常的类型 509
22.3 结构化异常处理程序 509
22.4 嵌套环境中的结构化异常处理 510
22.5 引发结构化异常 511
22.6 异常产生后的清理 512
22.7 c++异常处理 513
22.8 定义c++异常类 515
22.9 mfc异常处理 517
22.10 派生自己的与mfc兼容的
异常对象 523
22.11 删除异常 525
22.12 使用mfc异常宏 525
22.13 混合使用异常处理技术 526
22.14 小结 527
第六部分 mfc和web
第23章 mfc和dhtml 529
23.1 dhtml、msie和因特网 529
23.2 使用ie web activex 控件 530
23.2.1 ie activex控件基础 530
23.2.2 在对话框中使用
ie activex控件 536
23.3 使用dhtml 536
23.3.1 dhtml对象模型 539
23.3.2 dhtml com接口 542
23.4 小结 551
第24章 csocket程序设计 552
24.1 网络通信如何进行 552
24.2 winsock和mfc 553
24.2.1 winsock环境的初始化 554
24.2.2 创建一个socket 554
24.2.3 打开连接 555
24.2.4 发送和接收消息 556
24.2.5 关闭连接 557
24.2.6 socket事件 558
24.2.7 事件激发的控制 558
24.2.8 检测错误 559
24.2.9 获取socket信息 559
24.2.10 socket和i/o串行化 562
24.3 建立联网的应用程序 562
24.3.1 建立应用程序外壳 562
24.3.2 视窗布局和启动功能 563
24.3.3 casyncsocket类的继承 565
24.3.4 连接应用程序 567
24.3.5 发送和接收 569
24.3.6 终止连接 571
24.4 小结 572
第25章 wininet程序设计 573
25.1 web应用协议和wininet 573
25.1.1 超文本传输协议 573
25.1.2 文件传输协议 573
25.1.3 gopher协议 574
25.1.4 wininet api和mfc 575
25.2 因特网会话基础 575
25.2.1 cinternetsession 575
25.2.2 cinternetfile 581
25.2.3 cintenetexception 582
25.2.4 cinternetconnection 582
25.2.5 生成一个简单的wininet
应用程序 583
25.3 应用程序级功能 588
25.3.1 http类 589
25.3.2 ftp类 592
25.3.3 gopher 595
25.3.4 生成一个简单的ftp客户程序 597
25.4 小结 603
第26章 isapi扩展 604
26.1 基础 604
26.2 由此及彼 616
26.3 从get到post 619
26.4 添加一些窗体元素 620
26.4.1 修改窗体 621
26.4.2 修改分析图 621
26.4.3 声明和使用处理函数 621
26.4.4 添加单选组 622
26.5 其他窗体输入元素 625
26.5.1 修改窗体 625
26.5.2 修改分析图 626
26.5.3 修改处理函数 626
26.6 小结 627
第27章 mapi和mfc 628
27.1 通信应用程序接口 628
27.2 两个高级选择:简单
mapi和cmc 628
27.2.1 简单mapi 629
27.2.2 公共消息转发调用 629
27.2.3 mapimessage结构 630
27.2.4 mapifiledesc结构 631
27.3 mfc提供的受限的mapi功能 631
27.4 cdocument连接 631
27.4.1 以mfc方法实现mapi 631
27.4.2 cdocument::onfilesendmail
()方法 632
27.5 实例程序:mapi 1.exe 636
27.6 小结 638
第28章 tapi和mfc 639
28.1 概述 639
28.2 tapi发展简史 643
28.3 使用辅助电话 646
28.4 使用基本电话服务 647
28.4.1 配置tapi 647
28.4.2 连接tapi 654
28.4.3 用tapi传输数据 657
28.4.4 用tapi断开连接 658
28.4.5 结束tapi会话 659
28.5 小结 659
第七部分 mfc与图形编程
第29章 mfc和opengl 661
29.1 opengl是什么 661
29.2 图形基本知识 662
29.2.1 核心术语和关键概念 662
29.2.2 图形程序设计的数学基础 663
29.3 opengl基础 665
29.3.1 opengl数据类型 666
29.3.2 opengl函数命名约定 666
29.3.3 opengl渲染函数范围 667
29.3.4 opengl矩阵栈 668
29.3.5 opengl渲染描述表 669
29.4 最小opengl程序和自定义 671
29.4.1 生成基本mfc应用程序 671
29.4.2 添加自定义opengl基类 672
29.4.3 把自定义视图类整合进
应用程序 678
29.4.4 生成3维场景 678
29.4.5 把opengl库添加到项目
的链表 679
29.5 2维和3维模型 679
29.5.1 基本模型开发 680
29.5.2 模型变换 681
29.5.3 显示列表 683
29.6 光 686
29.6.1 opengl光处理技术的基础 686
29.6.2 光的类型 687
29.6.3 物体的材料特性 688
29.7 纹理贴图 689
29.7.1 opengl图像和windows独立
于设备的位图 689
29.7.2 贴纹理图 690
29.8 特殊效果 691
29.8.1 融合 691
29.8.2 雾化 692
29.9 小结 693
第30章 mfc和directx 694
30.1 directx是什么 694
30.1.1 directx概述 694
30.1.2 directx的部件 695
30.2 directx基础 696
30.2.1 com编程风格和directx
的差异 696
30.2.2 directx部件启动顺序 696
30.3 directdraw基础 697
30.3.1 directdraw初始化 697
30.3.2 directdraw和调色板 701
30.3.3 directdraw表面 704
30.3.4 建立directdraw表面 704
30.3.5 位图在表面间传送 705
30.3.6 清除directdraw表面 706
30.3.7 directdraw页面翻转 706
30.3.8 从一个窗口使用directdraw 708
30.4 在实际中使用directdraw 710
30.4.1 表面和位图 710
30.4.2 把位图加载进表面 710
30.4.3 调色板问题 713
30.4.4 窗口渲染 716
30.4.5 错误处理 717
30.4.6 directdraw关闭 719
30.5 小结 721
第31章 多媒体与mfc 722
31.1 多媒体基础 722
31.2 directx媒体播放器控件 722
31.2.1 媒体播放器控件支持的
媒体格式 723
31.2.2 媒体播放器详情 723
31.2.3 cmediaplayer类 724
31.3 使用媒体播放器控件 724
31.4 播放声音 731
31.4.1 与声波打交道 732
31.4.2 回到directsound 738
31.4.3 用directsound播放声响效果 740
31.5 小结 749
第八部分 高级mfc
第32章 注册表详解 751
32.1 windows注册表的使用 751
32.2 注册表结构 752
32.3 注册表的程序控制 754
32.4 注册表示例程序 755
32.4.1 注册表的key editor对话框 755
32.4.2 生成一个新键 756
32.4.3 删除一个键 759
32.4.4 删除名字/数值对 760
32.5 关于包装注册表函数 762
32.6 关于安装的几句话 762
32.7 小结 763
第33章 dll编写及使用 764
33.1 dll的优点 764
33.1.1 消除重复代码 764
33.1.2 模块特性和封装 764
33.1.3 可扩性 765
33.2 afx dll详解 765
33.3 导出类、函数和数据 765
33.3.1 导出效率的考虑 765
33.3.2 混合的名字 766
33.3.3 导出类 767
33.3.4 导出与导入 767
33.3.5 导出显函数 768
33.3.6 导出数据 768
33.3.7 导出mfc数据 769
33.3.8 导出析构函数 770
33.3.9 导出工具集include文件 771
33.3.10 导出选择 771
33.4 其他dll问题 772
33.4.1 afxloadlibrary和
afxfreelibrary 772
33.4.2 可扩充和可复用设计 772
33.4.3 资源分配 773
33.4.4 多模块定义文件 773
33.4.5 地址加载和链接程序 774
33.5 小结 775
第34章 创建自定义向导 776
34.1 属性表和属性页 776
34.1.1 cpropertysheet和
cpropertypage类 776
34.1.2 引导过程与属性表连接 777
34.2 创建一个向导 777
34.2.1 设置向导模式 778
34.2.2 激活向导的按钮 778
34.2.3 显示向导 778
34.2.4 向导通知消息 779
34.2.5 向后退 779
34.2.6 移到下一个 779
34.2.7 成功结束 779
34.3 示例程序:wizard1.exe 779
34.3.1 生成向导页对话模板资源 780
34.3.2 为每个对话资源创建对话类 781
34.3.3 welcome页详解:类
cintropage 782
34.3.4 about you页详解:
类cpage1 784
34.3.5 更新cpage2和cpage3的
向导信息 787
34.3.6 创建和显示向导 789
34.4 小结 790
前言
第一部分 mfc概述
第1章 mfc的结构 1
1.1 mfc的发展简史 1
1.2 mfc类的层次结构 4
1.2.1 cobject 4
1.2.2 ccmdtarget 8
1.2.3 cwinthread 11
1.2.4 cwinapp 14
1.2.5 cwnd 18
1.2.6 cframewnd 23
1.2.7 cview 24
1.2.8 cdocument 25
1.3 小结 27
第2章 mfc对话框、控件和数据的
交互操作 29
2.1 创建应用程序 29
2.1.1 启动和使用mfc appwizard 29
2.1.2 appwizard生成的代码 31
.2.2 修改应用程序 33
2.2.1 添加对话框控件 33
2.2.2 添加初始化信息 38
2.2.3 使用对话框控件 39
2.3 工具提示 40
2.3.1 激活工具提示 41
2.3.2 显示工具提示文本 41
2.4 对话框数据交换 42
2.4.1 标准ddx 42
2.4.2 updatedata 42
2.5 使用标准对话框 43
2.5.1 文件打开/保存对话框 43
2.5.2 颜色选择对话框 43
2.5.3 字体选择对话框 44
2.5.4 打印配置对话框 44
2.6 小结 45
第3章 windows的常用控件 46
3.1 常用控件的初始化和用法 46
3.2 用于windows常用控件的通知 47
3.2.1 通知消息的结构 47
3.2.2 通知进程概述 48
3.2.3 更好的通知消息处理方案 48
3.2.4 用on_notify_range
设定通知范围 49
3.3 热键控件:chotkeyctrl类 49
3.3.1 chotkeyctrl类的方法 50
3.2.2 创建chotkeyctrl对象并
对它进行初始化 50
3.3.3 使用热键控件 50
3.4 微调控件:cspinbuttonctrl类 51
3.4.1 微调控件的样式 52
3.4.2 cspinbuttoncrtl消息 52
3.4.3 cspinbuttonctrl类的方法 52
3.4.4 创建微控件并对它初始化 53
3.4.5 示例程序:spin 1 53
3.5 滑块控件:csliderctrl 56
3.5.1 滑块控件的样式 56
3.5.2 csliderctrl消息 57
3.5.3 csliderctrl类的方法 58
3.5.4 创建滑块控件并对它进行
初始化 59
3.5.5 滑块控件的示例程序slider1 60
3.5.6 示例程序slider1 61
3.6 进度栏控件:cprogressctrl类 63
3.6.1 cprogressctrl类的方法 63
3.6.2 创建cprogressctrl对象并对它
初始化 64
3.6.3 使用进度栏控件 64
3.7 图形列表:cimagelist类 65
3.7.1 cimagelist类的方法 65
3.7.2 创建cimagelist控件并对它
初始化 66
3.8 列表视图控件:clistctrl类 67
3.8.1 列表视图控件的样式 68
3.8.2 图形列表与列表视图控件 69
3.9 列表视图项目和子项目 69
3.9.1 列表视图通知消息 70
3.9.2 创建clistctrl对象并对它
进行初始化 71
3.9.3 使用列表视图控件 71
3.10 树状视图控件:ctreectrl类 73
3.10.1 树状视图控件的样式 73
3.10.2 树状视图通知消息 74
3.10.3 ctreectrl类的方法 74
3.10.4 创建树状视图控件并对它
进行初始化 75
3.10.5 使用ctreectrl对象 76
3.10.6 示例程序treelist.exe 76
3.11 选项卡控件:ctabctrl类 77
3.11.1 选项卡控件的样式 77
3.11.2 选项卡控件的通知消息 78
3.11.3 ctabctrl类的方法 78
3.11.4 选项卡项目的代码结构 79
3.11.5 创建选项卡控件 79
3.11.6 使用选项卡控件 80
3.12 动画控件:canimatectrl类 81
3.12.1 动画控件的样式 82
3.12.2 动画控件的通知消息 82
3.12.3 canimatectrl类的方法 82
3.12.4 创建动画控件 83
3.12.5 使用动画控件 83
3.13 多信息文本编辑控件:
cricheditctrl类 83
3.13.1 多信息文本编辑控件的
窗口样式 85
3.13.2 字符格式的结构 85
3.13.3 段落格式的结构 86
3.13.4 cricheditctrl类的方法 87
3.13.5 cricheditctrl与文本相关
的方法 88
3.13.6 cricheditctrl的文本选定方法 88
3.13.7 cricheditctrl的文本格式化
方法 88
3.13.8 cricheditctrl的编辑方法 89
3.13.9 cricheditctrl的剪贴板方法 89
3.13.10 cricheditctrl的通用方法 89
3.13.11 创建多动能编辑控件 90
3.13.12 使用多信息文本编辑控件 90
3.14 小结 91
第4章 画图、设备环境、位图与字体 92
4.1 设备环境 92
4.2 图形设备界面 92
4.3 mfc设备环境的类 93
4.3.1 基类cdc 94
4.3.2 使用cpaintdc类进行绘图 95
4.3.3 用cclientdc类管理客户
程序区域 97
4.3.4 用cwindowdc类管理图
文框窗口 98
4.4 windows的图形对象 99
4.4.1 画笔:cpen类 100
4.4.2 画刷:cbrush类 101
4.4.3 字体:cfont类 102
4.4.4 位图:cbitmap类 102
4.4.5 调色板:cpalette类 102
4.4.6 区域:crgn类 102
4.5 gdi坐标系 103
4.6 矢量图形 104
4.6.1 绘图模式 105
4.6.2 线条与折线 107
4.6.3 矩形 110
4.6.4 区域 112
4.6.5 多边形 113
4.6.6 椭圆 113
4.6.7 贝济埃曲线 115
4.7 字体与文本 117
4.7.1 字体特征 117
4.7.2 textmetric 结构 118
4.7.3 logfont结构 120
4.7.4 创建字体 121
4.7.5 绘制文本 123
4.8 示例程序:矢量图形和文本方法 124
4.9 光栅图形 125
4.9.1 有名的光栅操作 125
4.9.2 位图 125
4.9.3 随设备而定的位图 126
4.9.4 不受设备限制的位图 127
4.9.5 cbitmap类 127
4.9.6 传送和伸展位图 128
4.10 位图资源 129
4.10.1 资源附加给可执行文件 129
4.10.2 从可执行文件中获取图形资源 130
4.11 示例程序:介绍位图资源 131
4.12 小结 134
第5章 创建自定义控件 136
5.1 windows类与c++类 136
5.2 用于核实信息的编辑控件 137
5.3 时钟静态控件 138
5.3.1 控件的规格 139
5.3.2 画钟面 140
5.3.3 确定指针的位置 141
5.3.4 画指针 142
5.3.5 设置时间 143
5.3.6 建立标准控件的子类时
出现的向题 144
5.4 超级链接控件 144
5.4.1 实现方法 146
5.4.2 字体的处理 147
5.4.3 画窗口 148
5.4.4 控制光标 149
5.4.5 鼠标输入 150
5.4.6 键盘输入 152
5.4.7 运行超级链接 153
5.5 高级自定义控件 154
5.5.1 建立子类时的局限性 154
5.5.2 通知消息 155
5.5.3 将资源编辑器用于自定义类 156
5.6 小结 156
第6章 mfc应用程序对象、消息的
传送和空闲处理 157
6.1 mfc应用程序对象 157
6.1.1 cwinapp和应用程序的寿命 158
6.1.2 cwinapp数据成员 159
6.1.3 cwinapp的成员函数 162
6.1.4 initinstance—特定应用程序的
初始化 162
6.1.5 initinstance中的函数 165
6.1.6 对ole容器的支持 165
6.1.7 windows nt 3.5的3d外观 165
6.1.8 注册表的使用 166
6.1.9 最近使用的文件列表 166
6.1.10 sdi和mdi文档/视图 166
6.1.11 创建主图文框窗口 167
6.1.12 支持automation 167
6.1.13 支持多信息文本编辑控件 168
6.1.14 命令行的处理 168
6.2 消息传送、消息表和消息类别 169
6.2.1 消息传送 169
6.2.2 消息表 171
6.3 空闲处理 173
6.3.1 onidle 173
6.3.2 为对话框进行空闲处理 175
6.4 闪现屏幕组件 176
6.5 小结 177
第二部分 文档、视图和使用它们
的应用程序
第7章 文档/视图的结构 179
7.1 文档、图文框和视图 179
7.2 创建新文档 181
7.2.1 打开新文件 183
7.2.2 单个文档模板与多个文档模板 185
7.3 视图 185
7.3.1 cview类 185
7.3.2 cscrollview类 185
7.3.3 cformview类 186
7.3.4 数据库视图类 186
7.3.5 控件视图 186
7.3.6 改变sdi中的视图 189
7.3.7 使用mdi 193
7.4 小结 195
第8章 扩展用户界面 196
8.1 响应用户的输入 196
8.1.1 键盘消息 196
8.1.2 处理键盘消息 197
8.1.3 鼠标消息 198
8.1.4 处理鼠标消息 200
8.2 用户界面与appwizard 201
8.3 扩展菜单 202
8.3.1 获取菜单和弹出式菜单 202
8.3.2 增加菜单项 202
8.3.3 使用浮动的弹出式菜单 203
8.4 将控件栏投入使用 204
8.4.1 使用工具栏和复合工具栏 205
8.4.2 使用状态栏 208
8.4.3 显示和隐藏控件栏 209
8.4.4 支持工具提示 210
8.5 更新用户界面 211
8.6 属性表和向导 212
8.6.1 mfc对属性表和向导的
支持特性 213
8.6.2 创建简单的向导 215
8.7 分割视图 223
8.8 小结 224
第9章 打印 225
9.1 打印的基本概念 225
9.2 用mfc进行打印 225
9.2.1 在视图中打印 226
9.2.2 cprintinfo对象 227
9.2.3 打印菜单命令 228
9.3 打印与gdi映像模式 229
9.4 所见即所得的打印方式 230
9.4.1 应用程序的资源 230
9.4.2 应用程序类 232
9.4.3 视图类 232
9.5 文档的分页 236
9.5.1 在页数已知的情况下打印文档 236
9.5.2 在页数未知的情况下打印文档 237
9.5.3 打印页号 238
9.6 停止和取消打印作业 239
9.6.1 用onpreparedc ()函数停止
打印作业 239
9.6.2 用onprint ()函数停止打印作业 240
9.7 小结 240
第三部分 mfc和com编程
第10章 com 241
10.1 发展历史 241
10.2 接口、对象与方法 242
10.2.1 一些术语的说明 242
10.2.2 介绍一个实际的例子 243
10.2.3 iunknown接口 243
10.3 服务程序、客户程序与类 246
10.4 com运行期的环境 247
10.4.1 定义类工厂 247
10.4.2 com对象如何重复使用 248
10.5 排列与线程 248
10.5.1 排列 249
10.5.2 线程 250
10.6 com、ole和自动化 251
10.6.1 idispatch 251
10.6.2 自动化服务程序、对象和
控制程序 253
10.6.3 同时支持idispatch和iunknown 253
10.7 永久性com数据 253
10.8 标识com数据 255
10.9 传送数据 255
10.9.1 统一数据传送 256
10.9.2 可连接的对象 256
10.10 dcom 257
10.10.1 对象的创建 257
10.10.2 调用方法 259
10.10.3 安全问题 260
10.11 一些重要的信息 260
10.11.1 bstr 260
10.11.2 safearray 261
10.11.3 hresult 261
10.11.4 variant 262
10.12 其他参考书目 262
10.13 小结 262
第11章 com和mfc 263
11.1 了解afx全局函数 263
11.1.1 应用程序寿命的控制 263
11.1.2 客户程序控件的管理 266
11.1.3 连接点的管理 266
11.1.4 控件的注册 268
11.1.5 异常情况 269
11.1.6 初始化 269
11.1.7 许可权 270
11.1.8 类型信息 270
11.2 关于ole宏 271
11.2.1 类工厂 271
11.2.2 客户程序/容器常用的命令 271
11.2.3 控件属性的持久性 272
11.2.4 对话框数据交换 273
11.2.5 调度表 274
11.2.6 事件表 275
11.2.7 属性页数据表 278
11.2.8 属性页 278
11.2.9 类型库的访问 279
11.3 mfc和ole类的类别 279
11.3.1 活动文档 279
11.3.2 自动化 280
11.3.3 ole的常用对话框 281
11.3.4 容器 282
11.3.5 控件 284
11.3.6 拖曳和放置 285
11.3.7 文档服务程序 286
11.3.8 支持 287
11.4 小结 288
第12章 mfc ole 服务程序 289
12.1 文档服务程序 289
12.2 服务程序的类型 289
12.2.1 完整的服务程序 290
12.2.2 活动文档 290
12.2.3 容器/服务程序 290
12.2.4 小型服务程序 290
12.3 文档服务程序的设计 290
12.3.1 ole文档 291
12.3.2 活动文档 294
12.4 建立一个活动文档服务程序 298
12.4.1 一致性 298
12.4.2 显示视图 299
12.5 自动化服务程序 300
12.6 idispatch 301
12.7 odl中的idispatch派生接口 302
12.8 通过idispatch调用方法 303
12.8.1 getidsofnames 303
12.8.2 类型信息的方法 304
12.8.3 invoke 304
12.9 调度接口与普通接口不同 304
12.10 通过idispatch访问c++中的
自动化服务程序 305
12.11 双重接口 305
12.12 变码 306
12.13 使用mfc的自动化服务程序 308
12.13.1 服务程序的类型 308
12.13.2 声明和定义更多的调度接口 311
12.13.3 添加方法和属性 311
12.14 小结 313
第13章 mfc ole 客户程序 314
13.1 idispatch和它在自动化中的作用 314
13.2 自动化服务程序的接口定义 314
13.2.1 idl与atl 315
13.2.2 odl与mfc 316
13.2.3 双重接口 317
13.3 mfc与自动化 318
13.3.1 控制器 318
13.3.2 连接到服务程序 319
13.3.3 服务程序的回顾 321
13.4 创建控制器 321
13.4.1 使用coledispatchdriver 321
13.4.2 使用# import 325
13.4.3 远程自动化 332
13.5 小结 335
第14章 mfc activex控件 336
14.1 开发策略 336
14.1.1 mfc 336
14.1.2 atl 337
14.1.3 mfc与atl 337
14.2 控件开发 338
14.3 控件的两个方面 340
14.3.1 运行时 340
14.3.2 设计时 340
14.4 建立控件的子类 340
14.4.1 mfc 340
14.4.2 atl 341
14.5 组件类别 341
14.5.1 icatregister 342
14.5.2 icatinformation 342
14.6 方法、属性和事件 342
14.6.1 属性 342
14.6.2 方法 344
14.6.3 事件 344
14.7 属性页 346
14.8 组件注册 347
14.9 com对象子关键字 348
14.10 建立一个mfc控件 349
14.11 接口定义 351
14.12 一个快速atl移植 358
14.13 小结 362
第15章 mfc activex控件容器 363
15.1 活动文档容器 363
15.1.1 存储区 364
15.1.2 现场对象 365
15.1.3 原地激活 365
15.1.4 文档扩展 367
15.1.5 建立最简单的活动文档容器 367
15.2 ole控件 368
15.2.1 对已有项目添加包容 369
15.2.2 activex容器 369
15.2.3 控件包容和事件 375
15.3 小结 380
第16章 使用mfc和atl 381
16.1 什么是atl,为什么atl在mfc
编程中很重要 381
16.2 对mfc应用程序有帮助的atl com
支持 381
16.2.1 com指针 381
16.2.2 其他atl com支持 383
16.3 对mfc应用程序的高级atl支持 390
16.3.1 开始做mfc应用程序 390
16.3.2 添加所需要的atl支持 390
16.3.3 自动建立atl com支持代码 391
16.3.4 检查添加到mfc应用程序中
的atl代码 394
16.3.5 添加另外的atl com支撑文件 400
16.3.6 修改项目设置 401
16.3.7 建立客户端应用程序 401
16.4 小结 403
第17章 用脚本语言编写mfc程序 404
17.1 脚本编程基础 404
17.1.1 脚本编程接口 405
17.1.2 对偶接口 409
17.2 对象模型 411
17.3 实现一个脚本编程的程序 412
17.4 小结 421
第四部分 mfc数据库编程
第18章 mfc数据库处理 423
18.1 关系数据库概念 423
18.2 存储和检索数据 425
18.3 数据库通信机制 427
18.4 odbc/mfc 428
18.4.1 cdatabase 428
18.4.2 crecordset 429
18.5 dao 436
18.5.1 cdaoworkspace 436
18.5.2 cdaodatabase 437
18.5.3 cdaorecordset 438
18.5.4 cdaotabledef 438
18.5.5 cdaoquerydef 439
18.6 小结 440
第19章 高级数据库支持 441
19.1 数据存取的com途径 441
19.2 ole db消费者使用atl包装类 441
19.2.1 cdatasource 445
19.2.2 csession 446
19.2.3 存取器 447
19.2.4 行集 451
19.2.5 存取数据源的数据 454
19.3 使用ado c++接口 456
19.3.1 adoconnection 461
19.3.2 错误 463
19.3.3 adorecordset 463
19.3.4 adocommand 465
19.3.5 adofield 467
19.3.6 adoproperty 468
19.3.7 adoparameter 468
19.3.8 adoerror 469
19.4 小结 469
第五部分 mfc实用程序类
第20章 字符串和集合 471
20.1 字符串和字符串类 471
20.1.1 cstring类内情 471
20.1.2 字符串分配 472
20.1.3 某些cstring函数 474
20.1.4 cstring实际用法 476
20.1.5 cstring小结 478
20.2 集合 478
20.2.1 集合类内情 478
20.2.2 模板化集合 483
20.3 unl_multied应用程序 484
20.4 一种stl方法 488
20.5 总结 488
第21章 文件输入输出和mfc 489
21.1 cfile类 489
21.2 cfile类内情 491
21.2.1 cstdiofile类 494
21.2.2 cmemfile类 496
21.2.3 csharedfile类 497
21.3 cfiledialog类 497
21.4 用户定义的cfiledialog类 499
21.5 cfile和cfiledialog的实际使用 500
21.5.1 打开文件 500
21.5.2 从文件中读数据 502
21.6 一种传统的途径 504
21.7 小结 505
第22章 异常处理技术 506
22.1 异常处理的用法 506
22.2 异常的类型 509
22.3 结构化异常处理程序 509
22.4 嵌套环境中的结构化异常处理 510
22.5 引发结构化异常 511
22.6 异常产生后的清理 512
22.7 c++异常处理 513
22.8 定义c++异常类 515
22.9 mfc异常处理 517
22.10 派生自己的与mfc兼容的
异常对象 523
22.11 删除异常 525
22.12 使用mfc异常宏 525
22.13 混合使用异常处理技术 526
22.14 小结 527
第六部分 mfc和web
第23章 mfc和dhtml 529
23.1 dhtml、msie和因特网 529
23.2 使用ie web activex 控件 530
23.2.1 ie activex控件基础 530
23.2.2 在对话框中使用
ie activex控件 536
23.3 使用dhtml 536
23.3.1 dhtml对象模型 539
23.3.2 dhtml com接口 542
23.4 小结 551
第24章 csocket程序设计 552
24.1 网络通信如何进行 552
24.2 winsock和mfc 553
24.2.1 winsock环境的初始化 554
24.2.2 创建一个socket 554
24.2.3 打开连接 555
24.2.4 发送和接收消息 556
24.2.5 关闭连接 557
24.2.6 socket事件 558
24.2.7 事件激发的控制 558
24.2.8 检测错误 559
24.2.9 获取socket信息 559
24.2.10 socket和i/o串行化 562
24.3 建立联网的应用程序 562
24.3.1 建立应用程序外壳 562
24.3.2 视窗布局和启动功能 563
24.3.3 casyncsocket类的继承 565
24.3.4 连接应用程序 567
24.3.5 发送和接收 569
24.3.6 终止连接 571
24.4 小结 572
第25章 wininet程序设计 573
25.1 web应用协议和wininet 573
25.1.1 超文本传输协议 573
25.1.2 文件传输协议 573
25.1.3 gopher协议 574
25.1.4 wininet api和mfc 575
25.2 因特网会话基础 575
25.2.1 cinternetsession 575
25.2.2 cinternetfile 581
25.2.3 cintenetexception 582
25.2.4 cinternetconnection 582
25.2.5 生成一个简单的wininet
应用程序 583
25.3 应用程序级功能 588
25.3.1 http类 589
25.3.2 ftp类 592
25.3.3 gopher 595
25.3.4 生成一个简单的ftp客户程序 597
25.4 小结 603
第26章 isapi扩展 604
26.1 基础 604
26.2 由此及彼 616
26.3 从get到post 619
26.4 添加一些窗体元素 620
26.4.1 修改窗体 621
26.4.2 修改分析图 621
26.4.3 声明和使用处理函数 621
26.4.4 添加单选组 622
26.5 其他窗体输入元素 625
26.5.1 修改窗体 625
26.5.2 修改分析图 626
26.5.3 修改处理函数 626
26.6 小结 627
第27章 mapi和mfc 628
27.1 通信应用程序接口 628
27.2 两个高级选择:简单
mapi和cmc 628
27.2.1 简单mapi 629
27.2.2 公共消息转发调用 629
27.2.3 mapimessage结构 630
27.2.4 mapifiledesc结构 631
27.3 mfc提供的受限的mapi功能 631
27.4 cdocument连接 631
27.4.1 以mfc方法实现mapi 631
27.4.2 cdocument::onfilesendmail
()方法 632
27.5 实例程序:mapi 1.exe 636
27.6 小结 638
第28章 tapi和mfc 639
28.1 概述 639
28.2 tapi发展简史 643
28.3 使用辅助电话 646
28.4 使用基本电话服务 647
28.4.1 配置tapi 647
28.4.2 连接tapi 654
28.4.3 用tapi传输数据 657
28.4.4 用tapi断开连接 658
28.4.5 结束tapi会话 659
28.5 小结 659
第七部分 mfc与图形编程
第29章 mfc和opengl 661
29.1 opengl是什么 661
29.2 图形基本知识 662
29.2.1 核心术语和关键概念 662
29.2.2 图形程序设计的数学基础 663
29.3 opengl基础 665
29.3.1 opengl数据类型 666
29.3.2 opengl函数命名约定 666
29.3.3 opengl渲染函数范围 667
29.3.4 opengl矩阵栈 668
29.3.5 opengl渲染描述表 669
29.4 最小opengl程序和自定义 671
29.4.1 生成基本mfc应用程序 671
29.4.2 添加自定义opengl基类 672
29.4.3 把自定义视图类整合进
应用程序 678
29.4.4 生成3维场景 678
29.4.5 把opengl库添加到项目
的链表 679
29.5 2维和3维模型 679
29.5.1 基本模型开发 680
29.5.2 模型变换 681
29.5.3 显示列表 683
29.6 光 686
29.6.1 opengl光处理技术的基础 686
29.6.2 光的类型 687
29.6.3 物体的材料特性 688
29.7 纹理贴图 689
29.7.1 opengl图像和windows独立
于设备的位图 689
29.7.2 贴纹理图 690
29.8 特殊效果 691
29.8.1 融合 691
29.8.2 雾化 692
29.9 小结 693
第30章 mfc和directx 694
30.1 directx是什么 694
30.1.1 directx概述 694
30.1.2 directx的部件 695
30.2 directx基础 696
30.2.1 com编程风格和directx
的差异 696
30.2.2 directx部件启动顺序 696
30.3 directdraw基础 697
30.3.1 directdraw初始化 697
30.3.2 directdraw和调色板 701
30.3.3 directdraw表面 704
30.3.4 建立directdraw表面 704
30.3.5 位图在表面间传送 705
30.3.6 清除directdraw表面 706
30.3.7 directdraw页面翻转 706
30.3.8 从一个窗口使用directdraw 708
30.4 在实际中使用directdraw 710
30.4.1 表面和位图 710
30.4.2 把位图加载进表面 710
30.4.3 调色板问题 713
30.4.4 窗口渲染 716
30.4.5 错误处理 717
30.4.6 directdraw关闭 719
30.5 小结 721
第31章 多媒体与mfc 722
31.1 多媒体基础 722
31.2 directx媒体播放器控件 722
31.2.1 媒体播放器控件支持的
媒体格式 723
31.2.2 媒体播放器详情 723
31.2.3 cmediaplayer类 724
31.3 使用媒体播放器控件 724
31.4 播放声音 731
31.4.1 与声波打交道 732
31.4.2 回到directsound 738
31.4.3 用directsound播放声响效果 740
31.5 小结 749
第八部分 高级mfc
第32章 注册表详解 751
32.1 windows注册表的使用 751
32.2 注册表结构 752
32.3 注册表的程序控制 754
32.4 注册表示例程序 755
32.4.1 注册表的key editor对话框 755
32.4.2 生成一个新键 756
32.4.3 删除一个键 759
32.4.4 删除名字/数值对 760
32.5 关于包装注册表函数 762
32.6 关于安装的几句话 762
32.7 小结 763
第33章 dll编写及使用 764
33.1 dll的优点 764
33.1.1 消除重复代码 764
33.1.2 模块特性和封装 764
33.1.3 可扩性 765
33.2 afx dll详解 765
33.3 导出类、函数和数据 765
33.3.1 导出效率的考虑 765
33.3.2 混合的名字 766
33.3.3 导出类 767
33.3.4 导出与导入 767
33.3.5 导出显函数 768
33.3.6 导出数据 768
33.3.7 导出mfc数据 769
33.3.8 导出析构函数 770
33.3.9 导出工具集include文件 771
33.3.10 导出选择 771
33.4 其他dll问题 772
33.4.1 afxloadlibrary和
afxfreelibrary 772
33.4.2 可扩充和可复用设计 772
33.4.3 资源分配 773
33.4.4 多模块定义文件 773
33.4.5 地址加载和链接程序 774
33.5 小结 775
第34章 创建自定义向导 776
34.1 属性表和属性页 776
34.1.1 cpropertysheet和
cpropertypage类 776
34.1.2 引导过程与属性表连接 777
34.2 创建一个向导 777
34.2.1 设置向导模式 778
34.2.2 激活向导的按钮 778
34.2.3 显示向导 778
34.2.4 向导通知消息 779
34.2.5 向后退 779
34.2.6 移到下一个 779
34.2.7 成功结束 779
34.3 示例程序:wizard1.exe 779
34.3.1 生成向导页对话模板资源 780
34.3.2 为每个对话资源创建对话类 781
34.3.3 welcome页详解:类
cintropage 782
34.3.4 about you页详解:
类cpage1 784
34.3.5 更新cpage2和cpage3的
向导信息 787
34.3.6 创建和显示向导 789
34.4 小结 790
- 名称
- 类型
- 大小
光盘服务联系方式: 020-38250260 客服QQ:4006604884
云图客服:
用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问
Video Player
×
Audio Player
×
pdf Player
×
亲爱的云图用户,
光盘内的文件都可以直接点击浏览哦
无需下载,在线查阅资料!
