Chapter 1 Hello,ATL 1
What Is ATL? 1
Creating a COM Server 2
Inserting a COM Class 5
ContentsForeword 9
Adding Properties and Methods 11
Preface 13
Implementing Additional Interfaces 13
Support for Scripting 16
Adding Persistence 17
Adding and Firing Events 19
Using a Window 23
Implementing Component Categories 27
Adding a User Interface 28
Hosting a Control 29
Summary 32
Chapter 2 ATL Smart Types:Strings,BSTRs,VARIANTs,and Interface Pointers 33
String Data Types,Conversion Macros,and Helper Functions 33
The CComBSTR Smart BSTR Class 43
The CComBSTR Class 45
The ComVariant Smart VARIANT Class 61
The CComPtr,CComQIPtr,and CComDispatchOriver Smart Pointer Classes 74
Summary 90
Chapter 3 Objects in ATL 93
Recall:COM Apartments 93
Implementing IUnknown 95
The Layers of ATL 98
Threading Model Support 99
The Core of IUnknown 107
Your Class 114
CComObject et al. 120
ATL Creators 134
Debugging 149
Summary 155
Chapter 4 COM Servers 157
A Review of COM Servers 157
The Object Map and the CComModule Class 159
The Object Map 160
Methods Required of an Object Map Class 163
The CComModule Class 197
CComCoClass Revisited 206
Server Optimization Compilation Options 208
Summary 210
Chapter 5 Interface Maps 211
Recall:COM Identity 211
Table-Driven QueryInterface 213
Multiple Inheritance 220
Tear-off Interfaces 231
Aggregation:The Controlling Outer 239
Interface Map Tricks 248
Summary 256
A Review of COM Persistence 257
Chapter 6 Persistence in ATL 257
ATL Persistence Implementation Classes 268
The Property Map 268
The Persistence Implementations 270
Additional Persistence Implementations 285
Adding Marshal-by-Value Semantics Using Persistence 294
Summary 297
Chapter 7 Collections and Enumerators 299
COM Collection and Enumeration Interfaces 299
Enumerating Arrays 313
Enumerating STL Collections 324
Collections 335
STL Collections of ATL Data Types 341
Simple Collections 346
Object Models 349
Summary 354
Chapter 8 Connection Points 357
A Review of Connection Points 357
Creating an ATL-Based Connectable Object 361
Creating an Object That Is an Event Recipient 373
How It All Works:The Messy Implementation Details 386
Summary 405
Chapter 9 Windowing 407
The Structure of a Windows Application 407
CWindow 410
CWindowlmpl 416
CDialoglmpl 452
Windows Control Wrappers 462
CContainedWindow 468
Summary 474
Chapter 10 ActiveX Controls 475
A Review of ActiveX Controls 475
The BullsEye Control Requirements 477
Creating the Initial Control Using the ATL Wizard 486
The Initial BullsEye Source Files 489
Developing the BullsEye Control Step by Step 495
Summary 538
Chapter 11 Control Containment 539
How Controls Are Contained 539
Basic Control Containment 540
Hosting a Control in a Dialog 573
Composite Controls 581
HTML Controls 585
ATL's Control Containment Limitations 598
Summary 599
Appendix A C++ Templates by Example 601
The Need for Templates 601
Template Basics 603
A Different Kind of Polymorphism 605
Function Templates 611
Member Function Templates 612
Summary 613
Appendix B ATL Classes and Headers 615
Index 623