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 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 its 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.


The IObjectWithSite interface inherits from the IUnknown interface. IObjectWithSite also has these types of members:


The IObjectWithSite interface has these methods.


Retrieves the latest site passed using SetSite.


Enables a container to pass an object a pointer to the interface for its site.



Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]






IID_IObjectWithSite is defined as FC4801A3-2BA9-11CF-A229-00AA003D7352