COM Client Sites in Win32Asm

By Andrew M. Barfield, Xtreme Software
for distribution with the MASM32 package.

A COM "Client Site" is a structure in memory where COM objects like Internet Explorer or Media Player connect to applications that wish to use them. The "client" is an application that needs access to an object's abilities. The "site" refers to the actual place in memory that contains pointers to all of the various required interfaces. A client site is basically a middle-man between your application and a COM object. This middle-man is necessary because COM objects and the sites that use them can be implemented in many different ways.

A client site is a COM object itself. Likewise, an application establishes communication with an external COM object by first creating an instance of its own "Object" structure. This structure is a map to the client site and contains all of the required interfaces, and internal variables. The following Object struct was taken from the Browser demo. This demo shows how to use the Microsoft® Web Browser Control.
Object struct
	iUnknown IIUnknown <?>
	iBase0 dd ?

	iOleWindow IIOleWindow <?>
	iBase1 dd ?

	iOleClientSite IIOleClientSite <?>
	iBase2 dd ?

	iOleInPlaceSite IIOleInPlaceSite <?>
	iBase3 dd ?

	iDispatch IIDispatch <?>
	iBase4 dd ?

	iDocHostUIHandler IIDocHostUIHandler <?>
	iBase5 dd ?

	iDocHostShowUI IIDocHostShowUI <?>
	iBase6 dd ?

	nRefCount dd ?
Object ends