Home

Knives

Pens, Bowls and Jewelry

Software

Computer Books

Electronic Computer Books

Math Books

Innovative Textbooks

My Research Articles

About Me

Contact

Understanding

the Component Object Model

By Steven Roman

Understanding the Component Object Model is an electronic book that is roughly equivalent in size to a 110-page printed book. I am distributing it as a compiled HTML (CHM) help file, complete with a table of contents (see below), index and full-text search capability.

Understanding the Component Object Model sells for $12.95. To purchase by credit card through PayPal, click the PayPal image below. I will email the book to you (the file is about 600KB) as soon as I am able, which is generally within 24 hours of purchase.

Preface to the Book

The purpose of this book is to acquaint the Visual Basic and Visual C++ programmer (and perhaps other interested parties) with one of the most active, and certainly one of the most de riguer, aspects of the Windows environment - the Component Object Model, also known as COM.

COM is the underpinning for several technologies that have become the main focus of a very large contingent of the PC world. These technologies are ActiveX Automation, ActiveX controls and ActiveX documents. I will assume that the reader of this book has some familiarity with Visual Basic or Visual C++ programming, although the book can be profitably read by anyone who is not afraid of reading a few lines of code in either language and is really interested in understanding what COM is about.

While the Visual Basic programmer cannot access all of the features of COM (for this you must program in a language such as Visual C++), he or she can do quite a lot, thanks to the release of Visual Basic Version 5.0 (and later versions). While previous versions of Visual Basic allowed the VB programmer to create compound documents and ActiveX (OLE) Automation servers and clients, Version 5 allows the creation of the most sophisticated (to date) COM software components - ActiveX controls.

The book is organized into four chapters. The first chapter presents an overview of COM from a relatively high level. The second chapter provides a much more detailed look at COM, with a more-or-less complete example of how a traditional COM server and client might be constructed, using a pseudo C++ like code, which should be readable by those who do not program in Visual C++. Chapter 3 takes a careful look at an ActiveX (COM) technology called Automation and Chapter 4 takes a look at ActiveX controls.

Let me reemphasize the fact that the goal of the book it to provide the reader with a solid understanding of the principles of COM, not the details. This is the information that will stand the Visual Basic and Visual C++ programmer is good stead. However, if you just want to be told how to program in COM, then this book is probably not for you.

Sample Chapter

Download a sample chapter.

Table of Contents

Understanding the Component Object Model
   About the Author
Preface
Introduction
     What is COM?
     Communication Between Software Components
          Linear Programming with GOSUBs
          Programming with Procedures
          Programming with Code Modules
          Programming with Class Modules
          The Big Leap - COM
Chapter 1 - An Overview of COM
     Providing Services By Exposing Functions
     COM Objects and COM Classes
     Interface Confusion
          Definition 1
          Definition 2
          Definition 3 - COM Interfaces
     Picturing a COM Object
     The Binary Standard
     The COM Interface Contract and Versioning
     The Client Side of COM
     Type Libraries
     The Role of the System Registry
     What are OLE and ActiveX?
     What is Automation?
     What is an ActiveX Control?
     COM Concept, Design and Implementation
Chapter 2 - A More Detailed Look at COM
     Some C++ Syntax
     COM vTable Interfaces
     Why Visual Basic is not Suited to COM Programming
     COM Interfaces and Their Implementations
          Using Inheritance and Virtual Functions to Generate vTables
          Using Multiple Inheritance to Generate Multiple vTables
     Creating a COM Object
     The Ubiquitous IUnknown Interface
     Class Inheritance Diagrams
     Enhancing a COM Interface
     COM Class Factories
          The IClassFactory Interface
     Summary of COM Object Creation
     CoCreateInstance Again
     A More-or-Less Complete Example
          Step 1 - Declare the Interfaces and GUIDs
          Step 2 - Generate the GUIDs
          Step 3 - Define the Exported Functions
          Step 4 - The COM Server
          Step 5 - The COM Client
Chapter 3 - Automation
     What is Automation?
     Binding
     The IDispatch Interface
          Using IDispatch
     Binding and the vTable Interface
     Type Libraries
     Dual Interfaces
     In-Process and Out-of-Process Automation Servers
          Marshalling - The Proxy-Stub Connection
Chapter 4 - ActiveX Controls
     Motivation
     What is an ActiveX Control?
     Client Sites
     Control and Container Interfaces
     Properties
          Type Library Property Entries
          The Value Property
          Types of Properties
               Ambient Properties
               Extended Properties
               Control Properties
          Persistent Storage of Property Values
               Storages and Streams
               Transactions
     Compound Document Interfaces
          Interface IStorage
          Interface IStream
          The IPersist Interfaces
               Interface IPersist
               Interface IPersistStream
               Interface IPersistStreamInit
               Interface IPersistStorage 
               Interface IPersistFile
     Property Bags and Their Interfaces
          Property Pages
               Interface IPropertyPageSite
               Interface IPropertyPage
     Events
          Event Types
          How Events Work
               The Control Declares the Event Interface and Provides Type Information
               The Control Provides Information About its Event Set
               The Container Builds a Dispinterface for the Event Interface
               The Container Passes a Sink Pointer to the Control, Thus Establishing the Connection
               More on Connection Point Interfaces

Home