Siting and Containers

A site is a class implemented by a container, through which the container communicates with its contained objects (ActiveX controls and designers). Each contained object is associated with a site,  which acts as an intermediary between the container and the object. When an ActiveX designer requires the use of a method or property of its container, it requests the feature through its site. This design lets the container know which object is making the request.

The site implements the IOleClientSite interface (or the IOleControlSite interface, if it contains ActiveX controls), and the ActiveX designer implements the IOleObject interface, as in the following figure.

At design time, the site calls the designer's IOleObject::SetClientSite method, passing a pointer to the site. Through this pointer, the ActiveX designer can use the site's IDispatch interface to change ambient properties.

Although the site provides useful information to the container about what the designer and other contained objects are doing, siting makes interactions indirect. To use interfaces implemented by the container, the ActiveX designer must issue requests through the site. Services provide an efficient architecture for locating and using these interfaces.