| title | IObjectWithSiteImpl Class | Microsoft Docs | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||||||
| ms.date | 11/04/2016 | |||||||||||||
| ms.reviewer | ||||||||||||||
| ms.suite | ||||||||||||||
| ms.technology |
|
|||||||||||||
| ms.tgt_pltfrm | ||||||||||||||
| ms.topic | reference | |||||||||||||
| f1_keywords |
|
|||||||||||||
| dev_langs |
|
|||||||||||||
| helpviewer_keywords |
|
|||||||||||||
| ms.assetid | 4e1f774f-bc3d-45ee-9a1c-c3533a511588 | |||||||||||||
| caps.latest.revision | 18 | |||||||||||||
| author | mikeblome | |||||||||||||
| ms.author | mblome | |||||||||||||
| manager | ghogen | |||||||||||||
| translation.priority.ht |
|
This class provides methods allowing an object to communicate with its site.
template <class T>
class ATL_NO_VTABLE IObjectWithSiteImpl :
public IObjectWithSite
T
Your class, derived from IObjectWithSiteImpl.
| Name | Description |
|---|---|
| IObjectWithSiteImpl::GetSite | Queries the site for an interface pointer. |
| IObjectWithSiteImpl::SetChildSite | Provides the object with the site's IUnknown pointer. |
| IObjectWithSiteImpl::SetSite | Provides the object with the site's IUnknown pointer. |
| Name | Description |
|---|---|
| IObjectWithSiteImpl::m_spUnkSite | Manages the site's IUnknown pointer. |
The IObjectWithSite interface allows an object to communicate with its site. Class IObjectWithSiteImpl provides a default implementation of this interface and implements IUnknown by sending information to the dump device in debug builds.
IObjectWithSiteImpl specifies two methods. The client first calls SetSite, passing the site's IUnknown pointer. This pointer is stored within the object, and can later be retrieved through a call to GetSite.
Typically, you derive your class from IObjectWithSiteImpl when you are creating an object that is not a control. For controls, derive your class from IOleObjectImpl, which also provides a site pointer. Do not derive your class from both IObjectWithSiteImpl and IOleObjectImpl.
IObjectWithSite
IObjectWithSiteImpl
Header: atlcom.h
Queries the site for a pointer to the interface identified by riid.
STDMETHOD(GetSite)(
REFIID riid,
void** ppvSite);
If the site supports this interface, the pointer is returned via ppvSite. Otherwise, ppvSite is set to NULL.
See IObjectWithSite::GetSite in the Windows SDK.
Manages the site's IUnknown pointer.
CComPtr<IUnknown> m_spUnkSite;
m_spUnkSite initially receives this pointer through a call to SetSite.
Provides the object with the site's IUnknown pointer.
HRESULT SetChildSite(IUnknown* pUnkSite);
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.
Returns S_OK.
Provides the object with the site's IUnknown pointer.
STDMETHOD(SetSite)(IUnknown* pUnkSite);
See IObjectWithSite::SetSite in the Windows SDK.