PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/ATLCOMService/_ISimpleObjectEvents_CP.h

#
C Header | 36 lines | 31 code | 5 blank | 0 comment | 2 complexity | 572d94eac9c2ac3a86bed8b20930f521 MD5 | raw file
  1. #pragma once
  2. template<class T>
  3. class CProxy_ISimpleObjectEvents :
  4. public IConnectionPointImpl<T, &__uuidof(_ISimpleObjectEvents)>
  5. {
  6. public:
  7. HRESULT Fire_FloatPropertyChanging( FLOAT NewValue, VARIANT_BOOL * Cancel)
  8. {
  9. HRESULT hr = S_OK;
  10. T * pThis = static_cast<T *>(this);
  11. int cConnections = m_vec.GetSize();
  12. for (int iConnection = 0; iConnection < cConnections; iConnection++)
  13. {
  14. pThis->Lock();
  15. CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
  16. pThis->Unlock();
  17. IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p);
  18. if (pConnection)
  19. {
  20. CComVariant avarParams[2];
  21. avarParams[1] = NewValue;
  22. avarParams[1].vt = VT_R4;
  23. avarParams[0].byref = Cancel;
  24. avarParams[0].vt = VT_BOOL|VT_BYREF;
  25. DISPPARAMS params = { avarParams, NULL, 2, 0 };
  26. hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL);
  27. }
  28. }
  29. return hr;
  30. }
  31. };