This class provides methods allowing an object to communicate with its site.
实现一个对象与其对应的页面进行交互的方法
template< class T >class ATL_NO_VTABLE IObjectWithSiteImpl : public IObjectWithSite |
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.
对象的调用者将页面的IUnknown指针传给对象,对象将其保存,并在需要的时候通过方法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.
members:
methods:
SetSite |
Provides the object with the site's IUnknown pointer. |
STDMETHOD(SetSite)( IUnknown* pUnkSite ); |
GetSite |
Queries the site for an interface pointer. |
STDMETHOD(GetSite)( REFIID riid, void **ppvSite ); |
If the site supports this interface, the pointer is returned via ppvSite. Otherwise, ppvSite is set to NULL
SetChildSite |
Provides the object with the site's IUnknown pointer. |
properties:
m_spUnkSite |
Manages the site's IUnknown pointer. |
m_spUnkSite initially receives this pointer through a call to SetSite.