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