PartI Windows,Visual C++.NET,and Application Framework Fundamentals 3
1 Windows and Visual C++.NET 3
The Windows Programming Model 3
Message Processing 3
The Windows Graphics Device Interface 4
Resource-Based Programming 5
Memory Management 5
Dynamic-Link Libraries 6
The Win32 Application Programming Interface 6
Visual C++.NET Components 6
Visual C++.NET and the Build Process 8
The Resource View Window and the Resource Editors 9
The C/C++ Compiler 10
The Source Code Editor 10
The Resource Compiler 11
The Linker 11
The Debugger 11
The MFC Application Wizard 12
Class View 13
Solution Explorer 13
The Object Browser 13
Unified Modeling Language Tools 14
Online Help 15
Windows Diagnostic Tools 16
The MFC Library Version7 16
The ATL Library Version7.0 16
.NET Support 16
2 The Microsoft Foundation Class Library Application Framework 17
Why Use This Application Framework? 17
The Learning Curve 22
An Application Framework vs.a Class Library 23
An Application Framework Example 23
What s an Application Framework? 23
MFC Library Message Mapping 27
Documents and Views 27
PartⅡ MFC Essentials 33
3 Getting Started with the MFC Application Wizard 33
What s a View? 34
MFC Library Application Types 34
MFC Library User Interfaces 35
Ex03a:The“Do-Nothing”Application 35
The CEx03aView View Class 40
Drawing Inside the View Window:The Windows GDI 40
The OnDraw Member Function 40
Adding Draw Code to the Ex03a Program 41
The Windows Device Context 41
A Preview of the Resource Editors 43
The Contents of Ex03a.rc 43
Running the Dialog Resource Editor 44
Win32 Debug Target vs.Win32 Release Target 45
Understanding Precompiled Headers 46
Two Ways to Run a Program 48
4 Visual C++.NET Wizards 49
Wizard Types 49
How Wizards Work 50
Creating a Wizard 51
Creating a Wizard for Developing Web Applications Using Managed C++ 53
5 Windows Message Mapping 61
Getting User Input:Message Map Functions 62
The Message Map 62
Saving the View s State:Class Data Members 63
Invalid Rectangle Theory 64
The Window s Client Area 64
CRect,CPoint,and CSize Arithmetic 65
Determining Whether a Point Is Inside a Rectangle 65
The CRect LPCRECT Operator 66
Determining Whether a Point Is Inside an Ellipse 66
The Ex05a Example 66
Using Class View with Ex05a 70
Using Windows Mapping Modes 73
The MM_TEXT Mapping Mode 74
The Fixed-Scale Mapping Modes 75
The Variable-Scale Mapping Modes 76
Coordinate Conversion 78
The Ex05b Example:Converting to the MM_HIMETRIC Mapping Mode 79
Creating a Scrolling View Window 81
A Window Is Larger Than What You See 81
Scroll Bars 81
Scrolling Alternatives 81
The Ex05c Example:Scrolling 82
Accepting Keyboard Input 82
The OnlnitialUpdate Function 82
Using Other Windows Messages 86
The WM_CREATE Message 86
The WM_CLOSE Message 86
The WM_QUERYENDSESSION Message 86
The WM_DESTROY Message 87
The WM_NCDESTROY Message 87
6 Classic GDI Functions,Fonts,and Bitmaps 89
The Device Context Classes 89
The CClientDC and CWindowDC Display Context Classes 90
Constructing and Destroying CDC Objects 90
The State of the Device Context 91
The CPaintDC Class 92
GDI Objects 92
Constructing and Destroying GDI Objects 93
Tracking GDI Objects 94
Stock GDI Objects 94
The Lifetime of a GDI Selection 95
Fonts 96
Fonts Are GDI Objects 96
Selecting a Font 96
Displaying Fonts 97
Printing With Fonts 97
Logical Inches and Physical Inches on the Display 98
Computing Character Height 99
The Ex06a Example 100
The Ex06a Program Elements 103
The Ex06b Example 104
The Ex06B Program Elements 106
The Ex06c Example:CScrollView Revisited 107
The Ex06C Program Elements 110
The CScrollView SetScaleToFitSize Mode 112
Using the Logical Twips Mapping Mode in a Scrolling View 112
Bitmaps 112
GDI Bitmaps and Device-Independent Bitmaps 113
Color Bitmaps and Monochrome Bitmaps 114
DIBs and the CDib Class 114
A Few Words About Palette Programming 114
DIBs,Pixels,and Color Tables 116
The Structure of a DIB Within a BMP File 116
DIB Access Functions 118
The CDib Class 118
DIB Display Performance 125
The Ex06d Example 125
Going Further with DIBs 128
The Loadlmage Function 128
The DrawDibDraw Function 129
Putting Bitmaps on Pushbuttons 130
The Ex06e Example 131
Going Further With Bitmap Buttons 133
7 Dialog Boxes 135
Modal vs.Modeless Dialog Boxes 135
Resources and Controls 136
Programming a Modal Dialog Box 136
The Ex07a Example:The Dialog Box That Ate Cincinnati 137
Building the Dialog Resource 138
Creating the Dialog Class 145
Connecting the Dialog Box to the View 150
Understanding the Ex07a Application 152
Enhancing the Ex07a Application 153
Taking Control of the OnOK Exit 153
OnCancel Processing 154
Hooking Up the Scroll Bar Controls 155
Identifying Controls:CWnd Pointers and Control IDs 157
Setting the Dialog Box Background Color or a Control Color 157
Adding Dialog Controls at Run Time 158
Using Other Control Features 158
Windows Common Dialog Boxes 159
Nested Dialog Boxes 160
Deriving from the Common Dialog Classes 160
Using the CFileDialog Class Directly 160
The Ex07b Example:CFileDialog 161
Other Customizations for CFileDialog 166
Programming a Modeless Dialog Box 167
Creating Modeless Dialog Boxes 167
User-Defined Messages 168
Dialog Box Ownership 168
The Ex07c Example:A Modeless Dialog Box 169
8 Common Controls 177
The Progress Control 178
The Slider Control 178
Standard Common Controls 178
The Spin Control 179
The List Control 179
The Tree Control 180
The WM_NOTIFY Message 180
The Ex08a Example:Standard Common Controls 181
Advanced Common Controls 194
The Date and Time Picker 194
The Month Calendar 196
The Internet Protocol Address Control 196
The Extended Combo Box 197
The Ex08b Example:Advanced Common Controls 198
9 Using ActiveX Controls 211
ActiveX Controls vs.Ordinary Windows Controls 212
Ordinary Controls:A Frame of Reference 212
How ActiveX Controls Are Similar to Ordinary Controls 212
How ActiveX Controls Differ from Ordinary Controls:Properties and Methods 213
Installing ActiveX Controls 214
The Calendar Control 215
ActiveX Control Container Programming 217
Property Access 217
Visual Studio.NET s C++ Wrapper Classes for ActiveX Controls 217
MFC Application Wizard Support for ActiveX Controls 220
The Add Class Wizard and the Container Dialog Box 220
Locking ActiveX Controls in Memory 222
The Ex09a Example:An ActiveX Control Dialog Container 223
ActiveX Controls in HTML Files 232
Creating ActiveX Controls at Run Time 232
The Ex09b Example:The Web Browser ActiveX Control 233
Picture Properties 237
Bindable Properties:Change Notifications 238
10 Win32 Core Memory Management 241
Processes and Memory Space 241
The Windows 95/98 Process Address Space 243
The Windows NT/2000/XP Process Address Space 245
How Virtual Memory Works 245
The VirtualAlloc Function:Committed and Reserved Memory 248
The Windows Heap and the GlobalAlloc Function Family 249
The Small-Block Heap,the C++ new and delete Operators, and_heapmin 250
Memory_Mapped Files 251
Accessing Resources 253
Tips for Managing Dynamic Memory 254
Optimizing Storage for Constant Data 254
11 Windows Message Processing and Multi-Threaded Programming 257
Windows Message Processing 257
How a Single-Threaded Program Processes Messages 258
Yielding Control 258
The Ex11a Program 259
Timers 259
On-Idle Processing 263
Multi-Threaded Programming 264
Writing the Worker Thread Function and Starting the Thread 264
How the Main Thread Talks to a Worker Thread 265
How the Worker Thread Talks to the Main Thread 266
The Ex11b Program 267
Using Events for Thread Synchronization 269
The Ex11c Program 269
Thread Blocking 271
Critical Sections 272
User Interface Threads 274
Mutexes and Semaphores 274
PartⅢ MFC s Document-View Architecture 277
12 Menus,Keyboard Accelerators,the Rich Edit Control,and Property Sheets 277
The Main Frame Window and Document Classes 278
Windows Menus 279
Keyboard Accelerators 280
Command Processing 280
Command Message Handling in Derived Classes 281
Update Command User Interface Handlers 282
Commands That Originate in Dialog Boxes 282
The Application Framework s Built-in Menu Commands 283
MFC Text Editing Options 284
The CEditView Class 284
The CRichEditView Class 284
Enabling and Disabling Menu Commands 284
The CRichEditCtrl Class 285
The Ex12a Example 285
Property Sheets 292
Building a Property Sheet 292
Property Sheet Data Exchange 292
The Ex12a Example Revisited 293
The CMenu Class 306
Apply Button Processing 306
Creating Floating Shortcut Menus 307
Extended Command Processing 307
13 Toolbars and Status Bars 309
Control Bars and the Application Framework 309
Toolbars 310
The Toolbar Bitmap 310
Toolbar Button States 311
The Toolbar and Command Messages 311
Toolbar Update Command User Interface Message Handlers 312
Locating the Main Frame Window 313
ToolTips 313
The Ex13a Example:Using Toolbars 314
Status Bars 319
The Status Bar Definition 320
The Message Line 320
The Status Indicator 321
Taking Control of the Status Bar 321
The Ex13b Example:Using Status Bars 322
Rebars 328
Anatomy of a Rebar 328
The Ex13c Example:Using Rebars 329
Why Reusable Base Classes Are Difficult to Write 333
14 A Reusable Frame Window Base Class 333
The CPersistentFrame Class 334
The CFrameWnd::ActivateFrame Member Function 334
The PreCreateWindow Member Function 335
The Windows Registry 336
Using the CString Class 339
The Position of a Maximized Window 341
Control Bar Status and the Registry 341
Static Data Members 342
The Default Window Rectangle 342
The Ex14a Example:Using a Persistent Frame Window Class 342
Persistent Frames in MDI Applications 348
Document-View Interaction Functions 349
15 Separating the Document from Its View 349
The CView::GetDocument Function 350
The CDocument::UpdateAllViews Function 351
The CView::OnUpdate Function 351
The CView::OnlnitialUpdate Function 352
The CDocument::OnNewDocument Function 352
The Simplest Document-View Application 352
The CFormView Class 353
The CObject Class 354
The TRACE Macro 355
The afxDump Object 355
Diagnostic Dumping 355
The Dump Context and the CObject Class 356
Automatic Dump of Undeleted Objects 357
The Ex15a Example:A Simple Document-View Interaction 360
A More Advanced Document-View Interaction 367
The CDocument::DeleteContents Function 368
The CObList Collection Class 369
Using the CObList Class for a First-In,First-Out List 369
CObList Iteration:The POSITION Variable 370
The CTypedPtrList Template Collection Class 372
The Dump Context and Collection Classes 372
The Ex15b Example:A Multi-View SDI Application 373
Resource Requirements 375
Code Requirements 376
Protected Virtual Functions 389
Testing the Ex15b Application 390
Two Exercises for the Reader 390
16 Reading and Writing Documents 391
What Is Serialization? 391
Disk Files and Archives 392
Making a Class Serializable 393
Writing a Serialize Function 393
Loading from an Archive:Embedded Objects vs.Pointers 394
Serializing Collections 396
The Windows Application Object 397
The Serialize Function and the Application Framework 397
The SDI Application 397
The Document Template Class 399
The Document Template Resource 401
Multiple Views of an SDI Document 401
Creating an Empty Document: The CWinApp::OnFileNew Function 402
The Document Class s OnNewDocument Function 403
Connecting File Open to Your Serialization Code:The OnFileOpen Function 403
The Document Class s DeleteContents Function 404
Connecting the File Save and File Save As Commands to Your Serialization Code 404
The Ex16a Example:SDI with Serialization 405
The Document s “Dirty”Flag 405
CEx16aApp 406
CStudent 406
CMainFrame 410
The CEx16aDoc Class 413
The CEx16aView Class 414
Testing the Ex16a Application 414
Windows Explorer Launch and Drag and Drop 415
Program Registration 415
Double-Clicking on a Document 416
Enabling Drag and Drop 416
Program Startup Parameters 416
MDI Support 417
Experimenting with Explorer Launch and Drag and Drop 417
A Typical MDI Application,MFC Style 418
The MDI Application Object 419
The MDI Document Template Class 419
The MDI Frame Window and the MDI Child Window 420
The Main Frame and Document Template Resources 422
Creating an Empty Document 422
Creating an Additional View for an Existing Document 423
Loading and Storing Documents 424
Multiple Document Templates 424
The Ex16b Example:An MDI Application 425
Explorer Launch and Drag and Drop 425
CEx16bApp 426
CMainFrame 430
CChildFrame 432
Testing the Ex16b Application 434
MTI Support 434
The Ex16c Example:An MTI Application 435
Testing the Ex16c Application 436
17 Printing and Print Preview 437
Windows-Based Printing 437
Standard Printer Dialog Boxes 437
Display Pages vs.Printed Pages 439
Interactive Print Page Selection 439
Print Preview 440
Programming for the Printer 440
The Printer Device Context and the CView::OnDraw Function 440
The CView::OnPrint Function 440
Preparing the Device Context:The CView::OnPrepareDC Function 441
The Start and End of a Print Job 441
The Ex17a Example:A WYSIWYG Print Program 442
Reading the Printer Rectangle 448
Template Collection Classes Revisited:The CArray Class 449
The Ex17b Example:A Multi-Page Print Program 450
The Splitter Window 457
18 Splitter Windows and Multiple Views 457
View Options 458
Dynamic and Static Splitter Windows 459
The Ex18a Example:A Single View Class SDI Dynamic Splitter 459
Resources for Splitting 460
CMainFrame 460
Testing the Ex18a Application 461
The Ex18b Example:A Double View Class SDI Static Splitter 461
CHexView 462
CMainFrame 462
Testing the Ex18b Application 463
The Ex18c Example:Switching View Classes Without a Splitter 464
Resource Requirements 464
CMainFrame 464
Testing the Ex18c Application 466
The Ex18d Example:A Multiple View Class MDI Application 466
Resource Requirements 467
CEx18dApp 467
CMainFrame 468
Testing the Ex18d Application 469
19 Context-Sensitive Help 471
WinHelp vs.HTML Help 471
Rich Text Format 473
The Windows WinHelp Program 473
Writing a Simple Help File 474
An Improved Table of Contents 479
The Application Framework and WinHelp 480
Calling WinHelp 480
Using Search Strings 481
Calling WinHelp from the Application s Menu 481
Help Context Aliases 482
Determining the Help Context 482
F1 Help 483
Shift+F1 Help 483
Generic Help 484
Message Box Help:The AfxMessageBox Function 484
A Help Example with No Programming Required 485
Help Command Processing 487
F1 Procassing 487
Shift+F1 Processing 488
Example Ex19b:Help Command Processing 488
Header Requirements 489
CStringView 489
CHexView 490
Resource Requirements 490
Help File Requirements 490
MFC and HTML Help 491
Testing the Ex19b Application 491
Example Ex19c:HTML Help 492
20 Dynamic-Link Libraries 495
DLL Fundamentals 495
How Imports Are Matched to Exports 496
Implicit Linkage vs.Explicit Linkage 497
Symbolic Linkage vs.Ordinal Linkage 498
The DLL Entry Point:DllMain 499
Instance Handles:Loading Resources 499
How the Client Program Finds a DLL 500
Debugging a DLL 500
MFC DLLs:Extension vs.Regular 501
MFC Extension DLLs:Exporting Classes 502
The MFC Extension DLL Resource Search Sequence 502
The Ex20a Example:An MFC Extension DLL 503
The Ex20b Example:A DLL Test Client Program 505
MFC Regular DLLs:The AFX_EXTENSION_MODULE Structure 506
Using the AFX_MANAGE_STATE Macro 506
The MFC Regular DLL Resource Search Sequence 506
The Ex20c Example:An MFC Regular DLL 507
Updating the Ex20b Example:Adding Code to Test Ex20c.dll 509
A Custom Control DLL 510
A Custom Control s Window Class 511
What Is a Custom Control? 511
The MFC Library and the WndProc Function 512
Custom Control Notification Messages 512
User-Defined Messages Sent to the Control 513
The Ex20d Example:A Custom Control 513
Revising the Updated Ex20b Example:Adding Code to Test Ex20d.dll 518
21 MFC Programs Without Document or View Classes 521
The Ex21a Example:A Dialog Box-Based Application 521
The Application Class InitInstance Function 524
The Dialog Class and the Program Icon 525
The Ex21b Example:An SDI Application 526
The Ex21c Example:An MDI Application 528
PartⅣ COM,Automation,ActiveX,and OLE 531
22 The Component Object Model 531
ActiveX Technology 531
What is COM? 532
The Essence of COM 532
What is a COM Interface? 533
The IUnknown Interface and the QueryInterface Member Function 538
Reference Counting:The AddRef and Release Functions 541
Class Factories 541
The CCmdTarget Class 543
The Ex22a Example:Simulated COM 544
The COM CoGetClassObject Function 551
Real COM with the MFC Library 551
COM and the Windows Registry 552
Runtime Object Registration 553
How a COM Client Calls an In-Process Component 554
How a COM Client Calls an Out-of-Process Component 556
The MFC Interface Macros 559
The MFC COleObjectFactory Class 560
Wizard Support for COM In-Process Components 560
MFC COM Client Programs 562
The Ex22b Example:An MFC COM In-Process Component 562
The Ex22c Example:An MFC COM Client 566
Containment vs.Aggregation vs.Inheritance 568
Creating C++ Components for VBA 571
23 Automation 571
Automation Clients and Components 572
Excel:A Better Visual Basic Than Visual Basic 573
Properties,Methods,and Collections 575
Automation Interfaces 576
The IDispatch Interface 576
Automation Programming Choices 577
The MFC IDispatch Implementation 579
An MFC Automation Component 579
An MFC Automation Client Program 581
An Automation Client Program That Uses the Compiler s #import Directive 583
The VARIANT Type 584
The COleVariant Class 586
Parameter and Return Type Conversions for Invoke 589
Automation Examples 590
The Ex23a Example:An Automation Component EXE with No User Interface 591
The Ex23b Example:An Automation Component DLL 600
The Ex23c Example:An SDI Automation Component EXE with User Interface 609
The Ex23d Example:An Automation Client 616
The Ex23e Example:An Automation Client 632
VBA Early Binding 636
Registering a Type Library 636
How a Component Can Register Its Own Type Library 636
The IDL File 637
How Excel Uses a Type Library 638
Why Use Early Binding? 639
Faster Client-Component Connections 639
24 Uniform Data Transfer:Clipboard Transfer and OLE Drag and Drop 641
The IDataObject Interface 641
How IDataObject Improves on Standard Clipboard Support 642
The FORMATETC and STGMEDIUM Structures 642
FORMATETC 643
STGMEDIUM 644
IDataObject Interface Member Functions 644
MFC UDT Support 645
Other IDataObject Member Functions:Advisory Connections 645
The COleDataSource Class 646
The COleDataObject Class 647
MFC Data Object Clipboard Transfer 648
The MFC CRectTracker Class 650
CRectTracker Rectangle Coordinate Conversion 651
The Ex24a Example:A Data Object Clipboard 652
The CMainFrame Class 652
The CEx24aDoc Class 653
The CEx24aView Class 653
The Source Side of the Transfer 660
The Destination Side of the Transfer 660
MFC Drag and Drop 660
The Drag-and-Drop Sequence 661
The Ex24b Example:OLE Drag and Drop 662
The CEx24bDoc Class 662
The CEx24bView Class 663
25 Introducting the Active Template Library 667
Revisiting COM 667
The Core Interface:IUnknown 669
Writing COM Code 671
COM Classes That Use Multiple Inheritance 672
The COM Infrastructure 673
ActiveX,MFC,and COM 674
ActiveX,OLE,and COM 674
AtlBase.h 675
AN ATL Roadmap 675
AtlCom.h 676
AtlConv.cpp and AtlConv.h 676
AtlCtl.cpp and AtlCtl.h 676
AtllFace.idl and AtllFace.h 676
Atllmpl.cpp 676
Client-side ATL Programming 677
C++ Templates 677
StatReg.cpp and StatReg.h 677
AtlWin.cpp and AtlWin.h 677
Smart Pointers 679
Giving C++ Pointers Some Brains 681
Using Smart Pointers 682
Smart Pointers and COM 683
ATL s Smart Pointers 684
The CComPtrBase Class 684
The CComPtr Class 688
The CComQIPtr Class 690
ATL Smart Pointer Problems 692
ATL and COM Classes 693
Server-Side ATL Programming 693
ATL Project Options 694
Creating a Classic ATL COM Class 697
Apartments and Threading 698
Connection Points and ISupportErrorInfo 700
The Free-Threaded Marshaler 701
Implementing the Spaceship Class Using Classic ATL 701
Basic ATL Architecture 703
Managing Vtable Bloat 704
ATL s IUnknown:CComObjectRootEx 705
ATL and QueryInterface 708
Making the Spaceship Go 711
Adding Methods to an Interface 713
Dual Interfaces 714
ATL and IDispatch 716
The IMotion and IVisual Interfaces 717
Multiple Dual Interfaces 719
Attributed Programming 720
26 ATL and ActiveX Controls 723
What Are ActiveX Controls? 724
Using ATL to Write an ActiveX Control 725
Creating a Control 725
ATL s Control Architecture 730
Developing a Control 736
Creating an Attributed Control 768
Control Events in Attributed ATL 770
27 The OLE OB Templates 771
Why OLE DB? 771
The Basic OLE DB Architecture 773
The Basic OLe DB Template Architecture 774
The OLE DB Consumer Template Architecture 774
The OLE OB Provider Template Architecture 777
Creating an OLE DB Consumer 783
Using the OLE DB Consumer Code 787
Creating an OLE DB Provider 788
Modifying the Provider Code 795
Enhancing the Provider 797
Attributed OLE DB Programming 797
PartⅤ Programming for the Internet 805
28 Internet Essentials 805
An Internet Primer 806
Network Protocols and Layering 806
IP 807
UDP 808
IP Address Format:Network Byte Order 809
TCP 810
DNS 812
HTTP 814
Internet vs.Intranet 817
Building an Intranet 817
FTP 817
NTFS vs.FAT File Systems 818
Network Hardware 818
Configuring Windows for Networking 819
Intranet Host Names and the HOSTS File 819
Testing Your Intranet:The Ping Program 819
Synchronous vs.Asynchronous Winsock Programming 820
The MFC Winsock Classes 820
Winsock Programming 820
An Intranet for One Computer:The TCP/IP Loopback Address 820
The Blocking Socket Classes 821
A Simplified HTTP Server Program 830
A Simplified HTTP Client Program 832
Building a Web Server Using CHttpBlockingSocket 834
Ex28a Server Limitations 834
Ex28a Server Architecture 834
Using the Win32 TransmitFile Function 835
Building and Testing Ex28a 836
Building a Web Client Using CHttpBlockingSocket 837
The Ex28a Winsock Client 837
Ex28a Support for Proxy Servers 837
WinInet s Advantages over Winsock 838
Testing the Ex28a Winsock Client 838
WinInet 838
The MFC WinInet Classes 839
Internet Session Status Callbacks 841
A Simplified WinInet Client Program 843
Building a Web Client Using the MFC WinInet Classes 844
The Ex28a WinInet Client#1:Using CHttpConnection 844
Testing the WinInet Client#1 844
The Ex28a WinInet Client#2:Using OpenURL 844
Testing the WinInet Client#2 845
The MFC CAsyncMonikerFile Class 846
Monikers 846
Asynchronous Moniker Files 846
Using the CAsyncMonikerFile Class in a Program 847
Asynchronous Moniker Files vs.WinInet Programming 848
29 Introducing Dynamic HTML 849
The DHTML Object Model 850
Visual C++.NET and DHTML 854
The Ex29a Example:MFC and DHTML 855
The Ex29b Example:DHTML and MFC 856
The Ex29c Example:ATL and DHTML 860
Fore More Information 863
IIS 865
30 ATL Server 865
IIS Security 866
Internet Service Manager 866
IIS Directories 868
IIS Logging 870
Testing IIS 870
ISAPI Server EXtensions 870
CGI and ISAPI 870
A Simple ISAPI Server Extension GET Request 871
HTML Forms:GET vs.POST 871
Where Does ATL Server Fit In? 874
Enter ATL Server 874
ATL vs.ATL Server 874
The ATL Server Architecture 875
SRF Files 877
The Ex30a Example:An ATL Server Web Site 881
PartⅥ .NET and Beyond 887
31 Microsoft.NET 887
Windows Component Technology 887
Some Component History 888
What s Wrong with DLLs 888
The COM Technology 889
The Benefits of COM 890
The Drawbacks of COM 891
The Common Language Runtime 892
No Boundaries 892
It s All About Type 894
Common Language Runtime Types 895
The Common Language Specification 899
Assemblies 900
.NET Versioning 903
Living Within the Common Language Runtime 903
AppDomains 906
Threading and The Common Language Runtime 906
Interoperability 907
32 Managed C++ 909
The Common Language Runtime Is Your Friend 909
Why Use C++? 910
Managed C++ Extensions 912
Visual C++.NET and the Managed Extensions 914
The Ex32a Example:A Managed C++ DLl Assembly 914
DaysOFTheWeek 919
AManagedDelegate 920
DotCOMVP,SoftwareDeveloper,and Bum 920
AManagedClass 920
IAManagedInterface and Iperson 920
AManagedValueStruct and AManagedGcStruct 920
Making the Assembly Usable 921
The Ex32b Example:A Managed Client Executable 921
Adding Managed Extension Support 925
33 Programming Windows Forms Using Managed C++ 927
Windows Forms 927
Beneath the Veneer 928
The Windows Forms Structure 928
A Windows Forms Wizard 929
The Form Class 932
Handling Events 933
Drawing 934
What s Missing from Windows Forms 951
34 Programming ASP.NET Using Managed C++ 953
The Internet as a Development Platform 953
The Evolution of ASP.NET 954
The Role of IIS 956
ASP.NET s Compilation Model 957
The Page Class 957
Code-Behind 958
Web Forms 962
What Happened to ActiveX? 967
The HttpModule Object 969
The HttpApplication Object 969
The HTTP Pipeline 969
The HttpContext Object 969
The HttpHandler Object 972
Web Services 976
Web Services Using Managed C++ 976
WSDL and ASP.NET 978
Invoking Web Methods 979
35 Programming ADO.NET Using Managed C++ 981
Managed Providers 981
.NET Managed Providers 982
Connecting to the Database 983
Working with the Providers 983
Issuing Commands 986
Using Stored Procedures with a Command 986
Using Data Readers to Retrieve Data 987
Error Handling 989
ADO.NET Datasets 989
Using the Data Adapter to Populate Datasets 990
Creating In-Memory Datasets 991
Writing XML from Datasets 993
A Message Map Functions in the MFC Library 997
B MFC Library Runtime Class Identification and Dynamic Object Creation 1005
Index 1013