Siting the Visual Designer

ActiveX designers receive services through their site, which is established with the IOleObject::SetClientSite method (or through the IQuickActivate interface). The site functions as the designer's display location within its container on the screen.

The SetClientSite method takes one input parameter, a pointer to the site. The host calls this method after fully loading an instance of the object.

At run time, a public designer can be used within a host other than its container. By default, both the host and the container will call the designer's SetClientSite method to pass a client site pointer. If the designer is invisible at run time, it may not need the site pointer provided by the container, but only the client site pointer provided by the host. By setting the DESIGNERFEATURE_DONTSITE registry flag (see Chapter 11, "Registry Reference" for details), the designer can prevent the container from siting it at run time. Only the host will call the designer's SetClientSite method; the container will not call the method.

For example, an invisible public designer that is contained at run time within Internet Explorer does not need the client site pointer that Visual Basic provides; it needs only the pointer from Internet Explorer. This designer would set the DESIGNERFEATURE_DONTSITE flag in the registry so that its SetClientSite method is called only once, by Internet Explorer.

If the designer supports the IQuickActivate interface, the container does not call SetClientSite. Instead, it provides the client site pointer in the pClientSite member of the QACONTAINER structure that is a parameter to IQuickActivate. If the designer has registered the DESIGNERFEATURE_DONTSITE flag, then pClientSite will be NULL.