00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
#ifndef _XML4COMCP_H_
00031
#define _XML4COMCP_H_
00032
00033
template <
class T>
00034 class CProxyXMLDOMDocumentEvents :
public IConnectionPointImpl<T, &DIID_XMLDOMDocumentEvents, CComDynamicUnkArray>
00035 {
00036
00037
public:
00038 HRESULT
Fire_ondataavailable()
00039 {
00040 CComVariant varResult;
00041 T* pT = static_cast<T*>(
this);
00042
int nConnectionIndex;
00043
int nConnections = m_vec.GetSize();
00044
00045
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
00046 {
00047 pT->Lock();
00048 CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
00049 pT->Unlock();
00050 IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
00051
if (pDispatch !=
NULL)
00052 {
00053 VariantClear(&varResult);
00054 DISPPARAMS disp = {
NULL,
NULL, 0, 0 };
00055 pDispatch->Invoke(0xc6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult,
NULL,
NULL);
00056 }
00057 }
00058
return varResult.scode;
00059
00060 }
00061 HRESULT
Fire_onreadystatechange()
00062 {
00063 CComVariant varResult;
00064 T* pT = static_cast<T*>(
this);
00065
int nConnectionIndex;
00066
int nConnections = m_vec.GetSize();
00067
00068
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
00069 {
00070 pT->Lock();
00071 CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
00072 pT->Unlock();
00073 IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
00074
if (pDispatch !=
NULL)
00075 {
00076 VariantClear(&varResult);
00077 DISPPARAMS disp = {
NULL,
NULL, 0, 0 };
00078 pDispatch->Invoke(DISPID_READYSTATECHANGE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult,
NULL,
NULL);
00079 }
00080 }
00081
return varResult.scode;
00082
00083 }
00084 };
00085
#endif