Microsoft Chat Server Development Guide |
---|
The ISpecifyPropertyPages interface indicates that an object supports property pages. Each property page implements the IPropertyPage interface.
If you have created a new property page component in Visual Basic, the component will already support the necessary interfaces. The following steps are required for extensions (or property page components) that are written in C++ using ATL 5.0.
class ATL_NO_VTABLE CMessageFilter :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CMessageFilter, &CLSID_MessageFilter>,
public IDispatchImpl<IChatMsgFilter, &IID_IChatMsgFilter, &LIBID_MSGFILTERLib>,
public IDispatchImpl<IChatExtensionCallBack, &IID_IChatExtensionCallBack, &LIBID_CHATSVCLib>,
public IDispatchImpl<IChatServerCallBack, &IID_IChatServerCallBack, &LIBID_CHATSVCLib>,
public ISpecifyPropertyPagesImpl<CMessageFilter>
{
public:
.
.
.
BEGIN_COM_MAP(CMessageFilter)
COM_INTERFACE_ENTRY2(IDispatch, IChatMsgFilter)
COM_INTERFACE_ENTRY(IChatMsgFilter)
COM_INTERFACE_ENTRY(IChatExtensionCallBack)
COM_INTERFACE_ENTRY(IChatServerCallBack)
COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages)
END_COM_MAP()
public:
HRESULT ISpecifyPropertyPages_GetPages(CAUUID* pPages, ATL_PROPMAP_ENTRY* pMap);
HRESULT CMessageFilter::ISpecifyPropertyPages_GetPages(CAUUID* pPages, ATL_PROPMAP_ENTRY* pMap)
{
int nCnt = 0;
// Get count of unique pages
for(int i = 0; pMap[i].pclsidPropPage != NULL; i++)
{
if (!InlineIsEqualGUID(*pMap[i].pclsidPropPage, CLSID_NULL))
nCnt++;
}
pPages->pElems = NULL;
pPages->pElems = (GUID*) CoTaskMemAlloc(sizeof(CLSID)*nCnt);
if (pPages->pElems == NULL)
return E_OUTOFMEMORY;
nCnt = 0;
for(i = 0; pMap[i].pclsidPropPage != NULL; i++) {
if (!InlineIsEqualGUID(*pMap[i].pclsidPropPage, CLSID_NULL)) {
BOOL bMatch = FALSE;
for (int j=0;j<nCnt;j++) {
if (InlineIsEqualGUID(*(pMap[i].pclsidPropPage), pPages->pElems[j])) {
bMatch = TRUE;
break;
}
}
if (!bMatch)
pPages->pElems[nCnt++] = *pMap[i].pclsidPropPage;
}
}
pPages->cElems = nCnt;
return S_OK;
}
BEGIN_PROPERTY_MAP(CMessageFilter)
PROP_PAGE(CLSID_MsgFilterPP)
END_PROPERTY_MAP()
© 1998 Microsoft Corporation. All rights reserved.