COM Objects in Delphi, Part 1
Satellite objects
Continued from Satellites and Containers
The ISatelliteUnknown object type descends directly from the supplied IUnknown type and necessarily overrides the abstract methods corresponding to the three IUnknown functions. ISatelliteUnknown has a single protected data field called FContainer, of type IContainerUnknown (defined below), which is initialized in its Create constructor. The implementations for the three IUnknown functions simply return the result of calling the corresponding method in the container object. Depending on which interface it has requested, the calling program may gain access to the QueryInterface, AddRef, and Release functions directly through the container object or through any of its satellite objects.
If you've read much OLE literature, you'll realize that the names used in Figure 1 for the parameters to QueryInterface in the DelphCOM unit shown here are nonstandard. Usually the parameter representing the ID of the desired interface is named riid, and the parameter representing the returned object is called ppv. Since the names of the parameters have no significance outside of the object, I have replaced the cryptic standard names with the more intelligible WantIID and ReturnedObject.
Continues...
Published as Power Programming in the 01/07/97 issue of PC Magazine.