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.

135 lines
4.2 KiB

  1. #ifndef _COMPATUICP_H_
  2. #define _COMPATUICP_H_
  3. template <class T>
  4. class CProxy_IProgViewEvents : public IConnectionPointImpl<T, &DIID__IProgViewEvents, CComDynamicUnkArray>
  5. {
  6. //Warning this class may be recreated by the wizard.
  7. public:
  8. HRESULT Fire_DblClk(LONG lFlags)
  9. {
  10. CComVariant varResult;
  11. T* pT = static_cast<T*>(this);
  12. int nConnectionIndex;
  13. CComVariant* pvars = new CComVariant[1];
  14. if (pvars == NULL) {
  15. return HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
  16. }
  17. varResult.scode = S_OK;
  18. int nConnections = m_vec.GetSize();
  19. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  20. {
  21. pT->Lock();
  22. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  23. pT->Unlock();
  24. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  25. if (pDispatch != NULL)
  26. {
  27. VariantClear(&varResult);
  28. pvars[0] = lFlags;
  29. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  30. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  31. }
  32. }
  33. delete[] pvars;
  34. return varResult.scode;
  35. }
  36. HRESULT Fire_ProgramListReady()
  37. {
  38. CComVariant varResult;
  39. T* pT = static_cast<T*>(this);
  40. int nConnectionIndex;
  41. int nConnections = m_vec.GetSize();
  42. varResult.scode = S_OK;
  43. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  44. {
  45. pT->Lock();
  46. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  47. pT->Unlock();
  48. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  49. if (pDispatch != NULL)
  50. {
  51. VariantClear(&varResult);
  52. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  53. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  54. }
  55. }
  56. return varResult.scode;
  57. }
  58. };
  59. template <class T>
  60. class CProxy_ISelectFileEvents : public IConnectionPointImpl<T, &DIID__ISelectFileEvents, CComDynamicUnkArray>
  61. {
  62. //Warning this class may be recreated by the wizard.
  63. public:
  64. HRESULT Fire_SelectionComplete()
  65. {
  66. CComVariant varResult;
  67. T* pT = static_cast<T*>(this);
  68. int nConnectionIndex;
  69. int nConnections = m_vec.GetSize();
  70. varResult.scode = S_OK;
  71. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  72. {
  73. pT->Lock();
  74. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  75. pT->Unlock();
  76. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  77. if (pDispatch != NULL)
  78. {
  79. VariantClear(&varResult);
  80. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  81. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  82. }
  83. }
  84. return varResult.scode;
  85. }
  86. HRESULT Fire_StateChanged(LONG lState)
  87. {
  88. CComVariant varResult;
  89. T* pT = static_cast<T*>(this);
  90. int nConnectionIndex;
  91. CComVariant* pvars = new CComVariant[1];
  92. if (pvars == NULL) {
  93. return HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
  94. }
  95. varResult.scode = S_OK;
  96. int nConnections = m_vec.GetSize();
  97. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  98. {
  99. pT->Lock();
  100. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  101. pT->Unlock();
  102. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  103. if (pDispatch != NULL)
  104. {
  105. VariantClear(&varResult);
  106. pvars[0] = lState;
  107. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  108. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  109. }
  110. }
  111. delete[] pvars;
  112. return varResult.scode;
  113. }
  114. };
  115. #endif