The following definitions and conventions apply throughout this book:
A component is an implementation of a set of interfaces. A component is what you mark in your IDL file (or type library) with CoClass or a class in C#.
An object is an instance of a component. You can create objects by
calling CoCreateInstance( )
in C++, specifying the
class ID (the type) of the object you want to create. If you use
Visual Basic 6.0, you can create objects using new
or CreateObject( )
. A C# client uses
new
to create a new instance of a component.
I use the following terms in the book:
CoCreating refers to calling
CoCreateInstance()
in C++, or
new
or CreateObject( )
in
Visual Basic. Querying an object for an
interface refers to calling IUnknown::QueryInterface( )
on the object. Releasing an object
refers to calling IUnknown::Release( )
on the
object.
The graphical notations in Figure P-1 are used in almost every design diagram in the book. The “lollipop” denotes an interface, and a method call on an interface is represented by an arrow beginning with a full circle.
Error handling in the code samples is rudimentary. The code samples serve to demonstrate a design or a technical point, and cluttering them with too much error handing would miss the point. In a production environment, you should verify the returned HRESULT of every COM call, catch and handle exceptions in C#, and assert every assumption.
I use the following font conventions in this book:
Italic
is used for new terms, citations, online
links, filenames, directories, and pathnames.
Constant
width
is used to
indicate command-line computer output and code examples, as well as
classes, constants, functions, interfaces, methods, variables, and
flow-controlled statements.
Constant-width bold
is used for code emphasis and user input.
Constant-width
italic
is used to indicate replaceable
elements in code statements.