Lesson 1
COM Fundamentals and Basic Programming
This course discusses the Component Object Model also known as COM.
We will begin by examining the fundamental concepts of COM, COM servers, COM objects, and COM interfaces.
Once we have established a solid understanding of COM fundamentals, we'll study the active template library, also known as ATL (formerly known as the ActiveX template library). Using the ATL, we will develop a COM object, PhBook
, that implements a COM interface to manage a personal phone book.
We will also develop a COM client, PhCliXX
--that uses the address information managed by PhBook
.
COM: The Component Object Model
The Component Object Model (COM) forms the foundation upon which OLE and ActiveX technology is built. COM defines an API and a binary standard for communication between objects
tha's independent of any particular programming language or (in theory) platform.
COM objects are similar to the VCL objects you are familiar with, except that they have only methods and properties associated with them, not data fields.
A COM object consists of one or more interfaces, which are essentially tables of functions associated with that object.
You can call an interface's methods just like the methods of a Delphi object.
The component objects you use can be implemented from any EXE or DLL, although the implementation is transparent to you as a user of the object because of a service provided by COM called marshaling.
The COM marshaling mechanism handles all the intricacies of calling functions across the boundaries of processes and machines,
which makes it possible to use a 32-bit object from a 16-bit application or access an object located on machine A from an application running on machine B.
This intermachine communication is known as Distributed COM (DCOM).
Course goals
By the end of this course you will be able to:
- Describe the Component Object Model, i.e., COM servers, objects, and interfaces
- Use basic COM programming technology, including interface pointers,
IUnknown
interface navigation, IUnknown
reference counting, IclassFactory
, the interface definition language (IDL), Microsoft IDL compiler (MIDL), and the ATL
- Understand and use type libraries as part of the COM development process
- Develop source code for a basic in-process COM objects/servers and COM clients using the ATL
The series
COM Fundamentals I is the first of DistributedNetworks's two-part COM Series.