PageRenderTime 27ms CodeModel.GetById 12ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/ATLActiveX/_IATLActiveXCtrlEvents_CP.h

#
C++ Header | 36 lines | 31 code | 5 blank | 0 comment | 2 complexity | 96556909a14a55b8011e4b526379264f MD5 | raw file
 1#pragma once
 2
 3template<class T>
 4class CProxy_IATLActiveXCtrlEvents :
 5    public IConnectionPointImpl<T, &__uuidof(_IATLActiveXCtrlEvents)>
 6{
 7public:
 8    HRESULT Fire_FloatPropertyChanging( FLOAT NewValue,  VARIANT_BOOL * Cancel)
 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[2];
25                avarParams[1] = NewValue;
26                avarParams[1].vt = VT_R4;
27                avarParams[0].byref = Cancel;
28                avarParams[0].vt = VT_BOOL|VT_BYREF;
29                DISPPARAMS params = { avarParams, NULL, 2, 0 };
30                hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL);
31            }
32        }
33        return hr;
34    }
35};
36