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.

Methods

The IObjectWithSite interface inherits the methods of the IUnknown interface.

In addition, IObjectWithSite defines the following methods.

MethodDescription

SetSite

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

GetSite

Retrieves the latest site passed using SetSite.

 

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderOCIdl.h
IDLOCIdl.idl
IIDIID_IObjectWithSite is defined as FC4801A3-2BA9-11CF-A229-00AA003D7352

Send comments about this topic to Microsoft

Build date: 11/12/2009

Tags :


Community Content

ZeBobo5
C# declaration
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")] 
public interface IObjectWithSite
{
  void SetSite([In ,MarshalAs(UnmanagedType.IUnknown)] Object pUnkSite);
  void GetSite(ref Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out Object ppvSite);
}
Tags :

Page view tracker