IObjectWithSite  2V54_UA

The IObjectWithSite interface provides a simple way to support communication between an object and its site in the container.

Often an object needs to communicate directly with a container site object and, in effect, manage the site 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 simple siting mechanism (lighter than IOleObject) 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.

When to Implement

An object implements this interface so it s container can supply it with an interface pointer for its site object. Then, the object can communicate directly with its site.

When to Use

A container calls the SetSite method on this interface to provide an object with an interface pointer for its site.

Methods in Vtable Order

IUnknown1NEM0LU Methods

Description

QueryInterface2Y54585

Returns pointers to supported interfaces.

AddRef1SHW0SS

Increments reference count.

ReleaseDUW01A

Decrements reference count.

 

IObjectWithSite Methods

Description

SetSiteR825MP

Provides the site s IUnknown pointer to the object being managed.

GetSite1132XDC

Retrieves the last site set with IObjectWithSite::SetSite.