Source code of Windows XP (NT5)
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.

125 lines
3.8 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. 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[0] = lFlags;
  25. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  26. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  27. }
  28. }
  29. delete[] pvars;
  30. return varResult.scode;
  31. }
  32. HRESULT Fire_ProgramListReady()
  33. {
  34. CComVariant varResult;
  35. T* pT = static_cast<T*>(this);
  36. int nConnectionIndex;
  37. int nConnections = m_vec.GetSize();
  38. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  39. {
  40. pT->Lock();
  41. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  42. pT->Unlock();
  43. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  44. if (pDispatch != NULL)
  45. {
  46. VariantClear(&varResult);
  47. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  48. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  49. }
  50. }
  51. return varResult.scode;
  52. }
  53. };
  54. template <class T>
  55. class CProxy_ISelectFileEvents : public IConnectionPointImpl<T, &DIID__ISelectFileEvents, CComDynamicUnkArray>
  56. {
  57. //Warning this class may be recreated by the wizard.
  58. public:
  59. HRESULT Fire_SelectionComplete()
  60. {
  61. CComVariant varResult;
  62. T* pT = static_cast<T*>(this);
  63. int nConnectionIndex;
  64. int nConnections = m_vec.GetSize();
  65. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  66. {
  67. pT->Lock();
  68. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  69. pT->Unlock();
  70. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  71. if (pDispatch != NULL)
  72. {
  73. VariantClear(&varResult);
  74. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  75. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  76. }
  77. }
  78. return varResult.scode;
  79. }
  80. HRESULT Fire_StateChanged(LONG lState)
  81. {
  82. CComVariant varResult;
  83. T* pT = static_cast<T*>(this);
  84. int nConnectionIndex;
  85. CComVariant* pvars = new CComVariant[1];
  86. int nConnections = m_vec.GetSize();
  87. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  88. {
  89. pT->Lock();
  90. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  91. pT->Unlock();
  92. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  93. if (pDispatch != NULL)
  94. {
  95. VariantClear(&varResult);
  96. pvars[0] = lState;
  97. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  98. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  99. }
  100. }
  101. delete[] pvars;
  102. return varResult.scode;
  103. }
  104. };
  105. #endif