Often an object needs to communicate directly with a container site, that is managing the object itself. Outside of IOleObject::SetClientSite, there is no generic means through which an object becomes aware of its site. IObjectWithSite provides simple objects with a lightweight means (lighter than IOleObject) with a siting mechanism. This interface should only be used when IOleObject is not already in use.
Through IObjectWithSite, a container can pass the IUnknown pointer of its site to the object through IObjectWithSite::SetSite. Callers can also retrieve the latest site passed to IObjectWithSite::SetSite through IObjectWithSite::GetSite. This latter method is included as a hooking mechanism, allowing a third party to intercept calls from the object to the site.
Methods in Vtable Order
IUnknown Methods Description
QueryInterface
Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.
IObjectWithSite Methods Description
SetSite
Provides the siteÆs IUnknown pointer to the object being managed.
GetSite Retrieves the last site set with IObjectWithSite::SetSite.