Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

  1. #ifndef _EVENTWRAPPERCP_H_
  2. #define _EVENTWRAPPERCP_H_
  3. template <class T>
  4. class CProxy_IUploadEventsWrapperEvents : public IConnectionPointImpl<T, &DIID__IUploadEventsWrapperEvents, CComDynamicUnkArray>
  5. {
  6. //Warning this class may be recreated by the wizard.
  7. public:
  8. HRESULT Fire_onStatusChange(IMPCUploadJob * mpcujJob, tagUL_STATUS Status)
  9. {
  10. CComVariant varResult;
  11. T* pT = static_cast<T*>(this);
  12. int nConnectionIndex;
  13. CComVariant* pvars = new CComVariant[2];
  14. int nConnections = m_vec.GetSize();
  15. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  16. {
  17. pT->Lock();
  18. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  19. pT->Unlock();
  20. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  21. if (pDispatch != NULL)
  22. {
  23. VariantClear(&varResult);
  24. pvars[1] = mpcujJob;
  25. pvars[0] = Status;
  26. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  27. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  28. }
  29. }
  30. delete[] pvars;
  31. return varResult.scode;
  32. }
  33. HRESULT Fire_onProgressChange(IMPCUploadJob * mpcujJob, LONG lCurrentSize, LONG lTotalSize)
  34. {
  35. CComVariant varResult;
  36. T* pT = static_cast<T*>(this);
  37. int nConnectionIndex;
  38. CComVariant* pvars = new CComVariant[3];
  39. int nConnections = m_vec.GetSize();
  40. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  41. {
  42. pT->Lock();
  43. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  44. pT->Unlock();
  45. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  46. if (pDispatch != NULL)
  47. {
  48. VariantClear(&varResult);
  49. pvars[2] = mpcujJob;
  50. pvars[1] = lCurrentSize;
  51. pvars[0] = lTotalSize;
  52. DISPPARAMS disp = { pvars, NULL, 3, 0 };
  53. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  54. }
  55. }
  56. delete[] pvars;
  57. return varResult.scode;
  58. }
  59. };
  60. #endif