The Component Object Model The Component Object Model Specification
1. Table of Contents
How to Read This Document..........................................................................................................................5
Part I: Component Object Model Introduction............................................................................................9
1.1 Challenges Facing The Software Industry.........................................................................................................15
1. Introduction...............................................................................................................................................15
1.2 The Solution: Component Software..................................................................................................................18
1. The Component Software Solution: OLE’s COM...............................................................................................20
1.3 Objects and Interfaces.......................................................................................................................................36
1.4 Clients, Servers, and Object Implementors.......................................................................................................45
1.5 The COM Library.............................................................................................................................................50
1.6 COM as a Foundation.......................................................................................................................................51
Part II: Component Object Model Programming Interface......................................................................57
2. Component Object Model Technical Overview......................................................................................63
1. Objects and Interfaces.........................................................................................................................................64
1.7 COM Application Responsibilities....................................................................................................................76
1.8 The COM Client/Server Model.........................................................................................................................79
1.9 Object Reusability.............................................................................................................................................87
1.10 Connectable Objects and Events.....................................................................................................................90
1.11 Persistent Storage............................................................................................................................................91
1.12 Persistent, Intelligent Names: Monikers........................................................................................................101
1.13 Uniform Data Transfer..................................................................................................................................105
2. Objects And Interfaces............................................................................................................................111
2.1 Interfaces.........................................................................................................................................................112
2.2 Globally Unique Identifiers.............................................................................................................................122
2.3 The IUnknown Interface.................................................................................................................................123
2.4 Error Codes and Error Handling.....................................................................................................................132
2.5 Enumerators and Enumerator Interfaces.........................................................................................................145
2.6 Designing and Implementing Objects.............................................................................................................151
3. COM Applications..................................................................................................................................162
3.1 Verifying the COM Library Version................................................................................................................163
3.2 Library Initialization / Uninitialization...........................................................................................................165
3.3 Memory Management.....................................................................................................................................168
3.4 Memory Allocation Example..........................................................................................................................182
4. COM Clients............................................................................................................................................184
4.1 Identifying the Object Class............................................................................................................................185
4.2 Creating the Object.........................................................................................................................................186
4.3 Obtaining the Class Factory Object for a CLSID............................................................................................190
4.4 Initializing the Object.....................................................................................................................................198
4.5 Managing the Object.......................................................................................................................................199
4.6 Releasing the Object.......................................................................................................................................203
4.7 Server Management........................................................................................................................................ 204
5. COM Servers........................................................................................................................................... 207
5.1 Identifying and Registering an Object Class...................................................................................................208
5.2 Implementing the Class Factory......................................................................................................................217
5.3 Exposing the Class Factory.............................................................................................................................223
5.4 Providing for Server Unloading......................................................................................................................232
5.5 Object Handlers..............................................................................................................................................238
5.6 Object Reusability...........................................................................................................................................239
5.7 Emulating Other Servers.................................................................................................................................248
DRAFT: October 24, 1995 Page: 3 Copyright © 1992-95 Microsoft Corporation
All Rights Reserved
评论2