IObjectWithSite::SetSite

Provides the site's IUnknown pointer to the object. 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.

HRESULT SetSite(
  IUnknown* pUnkSite  //Pointer to IUnknown of the site managing 
                      // this object
);
 

Parameter

pUnkSite
[in] Pointer to the IUnknown interface pointer of the site managing this object. If NULL, the object should call IUnknown::Release on any existing site at which point the object no longer knows its site.

Return Value

S_OK
Returned in all circumstances.

Remarks

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

QuickInfo

  Windows NT: Use version 4.0 or later. New for OC96.
  Windows: Use Windows 95 or later. New for OC96.
  Windows CE: Unsupported.
  Header: Declared in ocidl.h.

See Also

IObjectWithSite::GetSite