search for books and compare prices
Tables of Contents for Mfc Programming
Chapter/Section Title
Page #
Page Count
Part I: Basic Windows
3
208
Chapter 1. Win32 and MFC
3
6
1.1 The Win32 Operating System
3
2
1.2 The Win32 API
5
1
1.3 The MFC Library
6
3
1.3.1 Encapsulation
6
1
1.3.2 Inheritance
6
3
Chapter 2. Hello, World
9
18
2.1 Introduction
9
2
2.2 MFC's Generic Program
11
7
2.2.1 The Resource Script
12
2
2.2.2 Precompiled Headers
14
1
2.2.3 The Application Object
14
3
2.2.4 The Main Window
17
1
2.3 Events and Messages
18
4
2.3.1 Events in MFC
19
1
2.3.2 Message Maps
19
3
2.3.2.1 Why Message Maps?
21
1
2.3.3 Handling a Message
22
1
2.4 Naming Conventions
22
5
2.4.1 Names in the Win32 API
23
1
2.4.2 Names in MFC
24
1
2.4.3 Names in This Text
24
3
Chapter 3. Menus
27
16
3.1 Introduction
27
1
3.2 Menu Basics
28
1
3.3 Menu Events
28
2
3.4 Creating a Menu
30
3
3.4.1 Loading and Attaching a Menu
31
2
3.5 Menu Items
33
2
3.5.1 Item State
33
1
3.5.2 Item Contents
34
1
3.6 Dynamic Menus
35
4
3.6.1 The Menu Bar
36
1
3.6.2 The System Menu
36
2
3.6.3 Context Menus
38
1
3.7 Keyboard Commands
39
1
3.8 Accelerators
40
1
3.9 More on Menus
41
2
Chapter 4. Dialogs
43
14
4.1 Introduction
43
1
4.2 Message Boxes
44
2
4.3 Simple Modal Dialogs
46
3
4.3.1 Creating a Dialog Resource
47
1
4.3.1.1 Meta Keys and Tab Order
48
1
4.3.2 Instantiating CDialog
48
1
4.3.3 Calling DoModal
49
1
4.4 More Complex Modal Dialogs
49
4
4.4.1 OnInitDialog
51
1
4.4.2 Responding to Dialog Controls
52
1
4.5 Modeless Dialogs
53
1
4.6 Internationalization
54
1
4.7 More on Dialogs
55
2
Chapter 5. Windows and Messages
57
20
5.1 Introduction
57
1
5.2 Win32 Window Classes
57
1
5.3 MFC Window Classes
58
1
5.4 The Lifecycle of a Window
59
7
5.4.1 Window Creation
59
1
5.4.1.1 Window Classes
60
1
5.4.1.2 Window and Class Styles
61
1
5.4.1.3 Position and Size
62
1
5.4.1.4 Startup Messages
63
1
5.4.2 Window Existence
63
2
5.4.3 Window Termination
65
1
5.5 Message Delivery
66
2
5.5.1 Synchronous Messages
67
1
5.6 The Window Explorer Program
68
9
5.6.1 Initialization
69
2
5.6.2 The style Class
71
2
5.6.3 The styleDlg Class
73
1
5.6.4 The sample Class
73
4
Chapter 6. Controls
77
64
6.1 Introduction
77
1
6.2 Dialog Data Exchange
78
1
6.3 A Catalog of Controls
79
57
6.3.1 Boxes
80
1
6.3.2 Labels
81
6
6.3.2.1 Tool Tips
82
5
6.3.2.1.1 A Closer Look at Tool Tips
84
1
6.3.2.1.2 Adding a Tool-Tip Control
85
2
6.3.3 Pictures
87
6
6.3.3.1 Icons and Bitmaps
87
1
6.3.3.2 Animation
88
4
6.3.3.3 Gauges
92
1
6.3.4 Buttons
93
11
6.3.4.1 Picture Buttons
95
2
6.3.4.2 Owner-Draw Buttons
97
2
6.3.4.2.1 Using Message Reflection
97
2
6.3.4.3 Spin Buttons
99
2
6.3.4.4 Headers
101
3
6.3.4.4.1 Using a Placeholder Control
102
1
6.3.4.4.2 Using a Custom Control
103
1
6.3.4.4.3 Creating and Responding to Header Buttons
103
1
6.3.5 Sliding Controls
104
6
6.3.5.1 Scrollbars
105
4
6.3.5.1.1 Understanding Win32 Prototypes
108
1
6.3.5.2 Sliders
109
1
6.3.6 Editable Text
110
4
6.3.6.1 Edit Controls
111
1
6.3.6.2 Rich-Text Edit Controls
112
2
6.3.7 Lists
114
22
6.3.7.1 Simple Lists
116
2
6.3.7.2 Simple Lists with Multiple Selection
118
1
6.3.7.3 Combo Boxes
119
1
6.3.7.4 Checklists
119
3
6.3.7.4.1 When Things Don't Work
120
2
6.3.7.5 Owner-Draw Lists
122
3
6.3.7.5.1 WM_MEASUREITEM in a Fixed-Height List Box
124
1
6.3.7.5.2 Drawing the Item
125
1
6.3.7.6 List Views
125
7
6.3.7.6.1 Creating the ImageLlists
127
1
6.3.7.6.2 Connecting the Image Lists
128
1
6.3.7.6.3 Creating the Columns
129
1
6.3.7.6.4 Creating the Items
129
1
6.3.7.6.5 Sorting the Report View
130
1
6.3.7.6.6 Changing Views
131
1
6.3.7.7 Trees
132
4
6.3.7.7.1 Initializing the Tree
133
2
6.3.7.7.2 Tree Notifications
135
1
6.4 Tabbed Dialogs
136
5
6.4.1 Creating a Property Sheet
137
1
6.4.2 Creating the Property Pages
138
1
6.4.2.1 Customizing a Property Sheet
139
1
6.4.3 Responding to Commands
139
2
Chapter 7. Common Dialogs
141
28
7.1 Introduction
141
1
7.2 Basic Usage
142
4
7.2.1 Using a Modal Common Dialog
142
3
7.2.1.1 Error Handling
143
2
7.2.2 Using a Modeless Common Dialog
145
1
7.3 Customization
146
3
7.3.1 Changing the Layout
146
3
7.3.1.1 Extending a Dialog
147
2
7.4 Example: Common Dialogs and the Rich-Text Control
149
20
7.4.1 Font and Color
150
6
7.4.1.1 The CHARFORMAT Data Structure
150
2
7.4.1.2 Customizing the Font Dialog
152
4
7.4.1.2.1 Debugging Strategy
154
1
7.4.1.2.2 Adding an Auto Apply Checkbox
155
1
7.4.2 File Open and Save
156
6
7.4.2.1 Reading and Writing a Rich-Text Control
157
1
7.4.2.2 Extending the File Open Dialog
158
4
7.4.2.2.1 Deriving a Class from CFileDialog
159
1
7.4.2.2.2 Creating the Auxiliary Resource
159
1
7.4.2.2.3 Creating Wrappers for the Auxiliary Controls
160
1
7.4.2.2.4 Managing the Auxiliary Control
161
1
7.4.3 Find and Replace
162
7
7.4.3.1 Creating the Dialog Object
162
1
7.4.3.2 Responding to the Find Dialog Notification
163
1
7.4.3.3 Searching a Rich-Text Control
164
1
7.4.3.4 Adding a Search-String History List
165
4
7.4.3.4.1 Modifying the Dialog Resource
166
1
7.4.3.4.2 Initializing the History List
167
1
7.4.3.4.3 Managing the History List
167
2
Chapter 8. Graphics, the Mouse, and the Keyboard
169
42
8.1 Introduction
169
1
8.2 The Graphics Device Interface
169
5
8.2.1 Device Contexts
170
2
8.2.1.1 Painting the Screen
172
1
8.2.2 Logical and Physical Objects
172
2
8.3 Line-Drawing Graphics
174
8
8.3.1 Pens
175
1
8.3.2 Brushes
176
1
8.3.3 Color
176
2
8.3.3.1 Screen Colors
177
1
8.3.3.2 Printer Colors
177
1
8.3.4 Coordinates and Mapping Modes
178
1
8.3.5 Raster Ops
179
2
8.3.6 Shapes
181
1
8.4 Text
182
6
8.4.1 Logical Fonts
183
1
8.4.2 Physical Fonts
184
1
8.4.3 Outputting Text
185
1
8.4.4 WYSIWYG Issues
186
2
8.4.4.1 Font Availability
186
1
8.4.4.2 Resolution and Aspect Ratio
186
1
8.4.4.3 Kerning
187
1
8.4.4.4 Strategies
187
1
8.5 The Mouse
188
3
8.5.1 Capturing the Mouse
189
2
8.6 The Keyboard
191
2
8.6.1 The Caret
193
1
8.7 Graphics: A Program to Create Two-Dimensional Drawings
193
18
8.7.1 Program Organization
194
2
8.7.1.1 The Concepts of Storage and Display
195
1
8.7.2 Collections
196
4
8.7.2.1 A Collection of Commands
199
1
8.7.3 Basic Drawing Operations
200
2
8.7.4 Tracking the Mouse
202
2
8.7.4.1 Capturing the Mouse
202
1
8.7.4.2 Drawing a Rubber-Band Shape
202
1
8.7.4.3 Releasing Mouse Capture
203
1
8.7.5 Monitoring the Keyboard
204
1
8.7.6 The Current Drawing Tool
205
6
Part II: The Application Framework
211
138
Chapter 9. Program Organization
211
20
9.1 Introduction
211
1
9.2 Program Styles
211
5
9.2.1 Document-Centered Applications
212
3
9.2.1.1 The Single Document Interface
213
1
9.2.1.2 The Multiple Document Interface
214
1
9.2.2 Task-Centered Applications
215
1
9.3 Documents, Views, Frames, and Templates
216
10
9.3.1 Shared Resource IDS
217
3
9.3.1.1 The Document String
218
1
9.3.2 The Command Line
219
1
9.3.3 The New Generic
220
6
9.3.3.1 The Application Class: mdi
221
2
9.3.3.2 The Main Frame Class: mainFrame
223
2
9.3.3.3 The Document Class: doc
225
1
9.3.3.4 The View Class: view
225
1
9.4 Runtime Classes
226
5
9.4.1 The Three Levels of Runtime Class Support
227
2
9.4.2 DynCreate
229
2
Chapter 10. Documents and Views
231
28
10.1 Introduction
231
1
10.2 Documents
231
20
10.2.1 The CDocument Class
232
1
10.2.2 The CArchive Class
233
2
10.2.3 Serialization
235
15
10.2.3.1 Runtime Class Information
235
1
10.2.3.2 Serializing Objects
236
2
10.2.3.3 DECLARE_SERIAL and IMPLEMENT_SERIAL
238
1
10.2.3.4 Serializing Collections
239
5
10.2.3.4.1 Example: Serializing Graphics
242
2
10.2.3.5 Schemas
244
3
10.2.3.5.1 Versionable Schemas
245
2
10.2.3.6 Serializing Data
247
3
10.2.3.6.1 Example: Serializing Text
248
2
10.2.3.6.2 Finding Needles in the MFC Haystack
250
1
10.2.4 Communicating with the Views
250
1
10.3 Views
251
3
10.3.1 Drawing
251
1
10.3.1.1 Example: Drawing Graphics
252
1
10.3.2 Handling User Input
252
1
10.3.3 Handling Commands
253
1
10.4 Commands
254
5
10.4.1 Command Routing
254
1
10.4.2 Sharing Menus
255
1
10.4.3 Controlling Menu State
256
3
Chapter 11. Toolbars and Status Bars
259
24
11.1 Control Bars
259
2
11.1.1 The CControlBar Class
259
2
11.2 Status Bars
261
9
11.2.1 Creating the Status-Bar Object
262
1
11.2.2 Creating the Status-Bar Window
262
1
11.2.3 Creating the Panes
262
1
11.2.4 Updating the Panes
263
4
11.2.4.1 Idle-Time Processing
264
1
11.2.4.2 User Interface Update Handlers
264
2
11.2.4.2.1 Example: Graphics Status Bar
265
1
11.2.4.3 Menu-Item Help
266
1
11.2.5 Swapping Status Bars
267
3
11.2.5.1 Example: Three Status Bars
267
3
11.3 Toolbars
270
8
11.3.1 Button Bars
270
2
11.3.2 Dialog Bars
272
4
11.3.2.1 Creating the Dialog Resource
273
1
11.3.2.2 Creating the Dialog-Bar Object
273
1
11.3.2.3 Creating the Dialog-Bar Window
274
2
11.3.3 Tool Tips and Fly-By Help
276
1
11.3.4 Docking
277
1
11.4 Hiding, Showing, and Updating Control Bars
278
5
11.4.1 Saving Location and State
279
4
Chapter 12. Specialized Views
283
38
12.1 Introduction
283
1
12.2 Scrolling Views
283
8
12.2.1 Mapping Modes
284
1
12.2.2 The CScrollView Class
284
3
12.2.2.1 Scale-to-Fit
287
1
12.2.3 Example: Using CScrollView
287
4
12.3 Splitters
291
9
12.3.1 Dynamic Splitters
292
1
12.3.2 Static Splitters
293
1
12.3.3 Example: Swapping Between Dynamic and Static Splitters
294
3
12.3.4 Setting the Active Pane
297
1
12.3.5 Synchronizing the Panes
298
2
12.4 Form Views
300
3
12.4.1 Creating the Form
300
1
12.4.1.1 Overriding PreCreateWindow
301
1
12.4.2 Displaying the Data
301
1
12.4.3 Edit Fields Within a Form
302
1
12.5 Control Views
303
3
12.5.1 Message Reflection
304
1
12.5.2 Example: Using a List Box as a View
304
2
12.6 Example: An Address Book
306
15
12.6.1 The Document and the Views
307
3
12.6.2 Program Operation
310
11
12.6.2.1 Serialization
310
2
12.6.2.2 Managing the Form
312
2
12.6.2.3 Managing the Tree
314
4
12.6.2.4 Managing the Document
318
3
Chapter 13. Printing and Previewing
321
28
13.1 Introduction
321
1
13.2 Support for Printing and Previewing
322
8
13.2.1 Printing
322
3
13.2.2 Previewing
325
2
13.2.3 Printing and Previewing Edit Controls
327
3
13.3 Example: WYSIWYG Printing
330
2
13.3.1 Scaling the Output to Fit
330
2
13.4 Example: Page Setup
332
4
13.4.1 Changing Printer Attributes
335
1
13.4.2 Customizing Page Setup
335
1
13.5 Example: Multiple-Page Output
336
6
13.5.1 Printing a Control View
337
5
13.5.1.1 OnPreparePrinting
338
1
13.5.1.2 OnBeginPrinting
338
1
13.5.1.3 OnPrepareDC
339
1
13.5.1.4 OnPrint
340
2
13.5.1.5 OnEndPrinting
342
1
13.6 Example: Printing a Form
342
7
13.6.1 OnPreparePrinting
343
1
13.6.2 OnPrint
344
1
13.6.3 Controlling the Status Bar During Preview
345
4
Part III: Extended Examples
349
74
Chapter 14. Dialog-Based Applications
349
34
14.1 Introduction
349
1
14.2 Hangman: A Dialog-Based Game
350
11
14.2.1 The Application Class
351
4
14.2.2 The Dialog Class
355
1
14.2.2.1 The Dialog Resource
355
1
14.2.2.2 Initialization
356
2
14.2.2.3 Handling a Guess
358
3
14.3 Wizard: A Dialog-Based Installation Program
361
22
14.3.1 The Application Class
362
2
14.3.1.1 The Data Class
363
1
14.3.2 The Property Sheet
364
1
14.3.3 The Property Pages
365
8
14.3.3.1 The Start Page
366
1
14.3.3.2 The Installation-Directory Page
366
2
14.3.3.3 The Select Page
368
3
14.3.3.4 End Page
371
2
14.3.4 The Browse Dialog
373
1
14.3.5 The Copy Dialog
373
5
14.3.5.1 Finding the Root of the Source Tree
375
1
14.3.5.2 Counting the Number of Files to be Copied
375
1
14.3.5.3 Posting and Updating the Status Dialog
376
1
14.3.5.4 Spawning a Worker Thread to Perform Copying
376
1
14.3.5.5 Monitoring the Worker Thread and the Cancel Button
377
1
14.3.5.6 Terminating the Status Dialog
377
1
14.3.6 The Worker Thread
378
5
Chapter 15. Dynamic Link Libraries
383
16
15.1 Introduction
383
1
15.2 How DLLs Are Used
383
4
15.2.1 Shared Libraries
384
1
15.2.2 Dynamic Data and Code
384
1
15.2.3 In-Process Servers
385
2
15.3 Using a DLL
387
4
15.3.1 Implicit and Explicit Loading
387
1
15.3.2 Example: Explicit Loading
387
4
15.3.2.1 C Function Interface
388
2
15.3.2.2 Resources in a DLL
390
1
15.4 Creating DLLs
391
8
15.4.1 Exporting Names
393
3
15.4.2 Example: MFC Extension DLL
396
1
15.4.3 Example: Dynamic Resources
397
2
Chapter 16. A Simple Internet Browser
399
24
16.1 Introduction
399
1
16.2 Overview
400
1
16.3 Initialization
401
1
16.4 Displaying the Text
402
4
16.5 The Text in Memory
406
2
16.5.1 Serializing the Text
407
1
16.6 Connecting to the Internet
408
5
16.6.1 Integrating Internet Access with the Document
410
1
16.6.2 Testing an URL for validity
410
2
16.6.3 Selecting an URL
412
1
16.7 Worker Threads
413
7
16.7.1 Processes and Threads in Win32
413
1
16.7.2 Background Processing
414
2
16.7.3 Synchronizing the Threads
416
1
16.7.4 Sharing Objects Across Threads
417
3
16.8 Controlling the Cursor
420
3
Appendix
423
2
Index
425