source: trunk/Utilities/VbsCallback/_IThirdEvents_CP.h @ 88

Last change on this file since 88 was 88, checked in by roman, 12 years ago
File size: 879 bytes
Line 
1#pragma once
2
3template<class T>
4class CProxy_IThirdEvents :
5        public ATL::IConnectionPointImpl<T, &__uuidof(_IThirdEvents)>
6{
7public:
8        HRESULT Fire_InnerDo(VARIANT * pvC)
9        {
10                HRESULT hr = S_OK;
11                T * pThis = static_cast<T *>(this);
12                int cConnections = m_vec.GetSize();
13
14                for (int iConnection = 0; iConnection < cConnections; iConnection++)
15                {
16                        pThis->Lock();
17                        CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
18                        pThis->Unlock();
19
20                        IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p);
21
22                        if (pConnection)
23                        {
24                                CComVariant avarParams[1];
25                                avarParams[0].pvarVal = pvC;
26                                avarParams[0].vt = VT_VARIANT|VT_BYREF;
27                                DISPPARAMS params = { avarParams, NULL, 1, 0 };
28                                hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL);
29                        }
30                }
31                return hr;
32        }
33};
34
Note: See TracBrowser for help on using the repository browser.