• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

xml4comCP.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  * 
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  * 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * $Id: xml4comCP.h 568078 2007-08-21 11:43:25Z amassari $
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         //Warning this class may be recreated by the wizard.
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

Generated on Thu Jan 12 2012 23:13:51 for ACS-10.0 C++ API by  doxygen 1.7.0