IObjectWithSite::SetSite method

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

Syntax

HRESULT SetSite(
  IUnknown *pUnkSite
);

Parameters

pUnkSite

A pointer to the IUnknown interface pointer of the site managing this object. If NULL, the object should call Release on any existing site at which point the object no longer knows its site.

Return Value

This method returns S_OK on success.

Remarks

The object should hold onto this pointer, calling IUnknown::AddRef in doing so. If the object already has a site, it should call that existing site's IUnknown::Release, save the new site pointer, and call the new site's IUnknown::AddRef.

E_NOTIMPL is not allowed—without implementation of the SetSite method, the IObjectWithSite interface is unnecessary.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ocidl.h

See Also

IObjectWithSite