Client-Server Communication: A Low-Level View
Let’s begin by examining what is required for a client to be able to create a COM object that lives in a DLL. (In Chapter 5, you will see that the process is slightly different for ActiveX EXEs.) But first you must learn the true name of a COM component.
GUIDs
As we noted in Section 3.5 in Chapter 3, the official name for classes and interfaces
is not the string name you assign to the class or interface while
developing in VB. You may recall that QI enables
developers to ask an object for a particular interface
implementation. It also enables developers to find out if an object
in fact supports an interface. The first parameter in
QI is the interface “name.” It is an
input parameter. The second parameter is an
out parameter returned by the object with a
pointer to the vptr of the requested interface.
The name IAccount is not unique enough for
QI to work for every interface ever defined.
Think about how many companies writing COM-based banking applications
may use the name IAccount for their primary
interface definition.
QueryInterface
would not know if you were asking for company A’s
IAccount or company B’s
IAccount. Therefore, Microsoft decided to use
another mechanism for naming interfaces. Instead of using the string
name, COM identifies each interface by a number—a very big
number
known
as a globally unique identifier, or GUID.
A GUID is a 128-bit number. An example of a GUID is 36B1C83C-62D0-4199-AF2E-A7A73505EA65—the registry is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access