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.

260 lines
7.7 KiB

  1. //===========================================================================
  2. //
  3. // msvidcp.h : msvidctl event connection point handler
  4. // Copyright (c) Microsoft Corporation 1999-2000.
  5. //
  6. /////////////////////////////////////////////////////////////////////////////
  7. #ifndef _MSVideoCP_H_
  8. #define _MSVideoCP_H_
  9. //#import "..\..\common\include\MSVidCtl.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids //"Import typelib"
  10. template <class T>
  11. class CProxy_IMSVidCtlEvents : public IConnectionPointImpl<T, &DIID__IMSVidCtlEvents, CComDynamicUnkArray>
  12. {
  13. //Warning this class may be recreated by the wizard.
  14. public:
  15. VOID Fire_Click()
  16. {
  17. T* pT = static_cast<T*>(this);
  18. int nConnectionIndex;
  19. int nConnections = m_vec.GetSize();
  20. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  21. {
  22. pT->Lock();
  23. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  24. pT->Unlock();
  25. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  26. if (pDispatch != NULL)
  27. {
  28. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  29. pDispatch->Invoke(DISPID_CLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  30. }
  31. }
  32. }
  33. VOID Fire_DblClick()
  34. {
  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. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  47. pDispatch->Invoke(DISPID_DBLCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  48. }
  49. }
  50. }
  51. VOID Fire_KeyDown(SHORT * KeyCode, SHORT Shift)
  52. {
  53. T* pT = static_cast<T*>(this);
  54. int nConnectionIndex;
  55. CComVariant* pvars = new CComVariant[2];
  56. int nConnections = m_vec.GetSize();
  57. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  58. {
  59. pT->Lock();
  60. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  61. pT->Unlock();
  62. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  63. if (pDispatch != NULL)
  64. {
  65. pvars[1] = KeyCode;
  66. pvars[0] = Shift;
  67. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  68. pDispatch->Invoke(DISPID_KEYDOWN, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  69. }
  70. }
  71. delete[] pvars;
  72. }
  73. VOID Fire_KeyPress(SHORT * KeyAscii)
  74. {
  75. T* pT = static_cast<T*>(this);
  76. int nConnectionIndex;
  77. CComVariant* pvars = new CComVariant[1];
  78. int nConnections = m_vec.GetSize();
  79. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  80. {
  81. pT->Lock();
  82. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  83. pT->Unlock();
  84. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  85. if (pDispatch != NULL)
  86. {
  87. pvars[0] = *KeyAscii;
  88. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  89. pDispatch->Invoke(DISPID_KEYPRESS, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  90. }
  91. }
  92. delete[] pvars;
  93. }
  94. VOID Fire_KeyUp(SHORT * KeyCode, SHORT Shift)
  95. {
  96. T* pT = static_cast<T*>(this);
  97. int nConnectionIndex;
  98. CComVariant* pvars = new CComVariant[2];
  99. int nConnections = m_vec.GetSize();
  100. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  101. {
  102. pT->Lock();
  103. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  104. pT->Unlock();
  105. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  106. if (pDispatch != NULL)
  107. {
  108. pvars[1] = KeyCode;
  109. pvars[0] = Shift;
  110. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  111. pDispatch->Invoke(DISPID_KEYUP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  112. }
  113. }
  114. delete[] pvars;
  115. }
  116. VOID Fire_MouseDown(SHORT Button, SHORT Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
  117. {
  118. T* pT = static_cast<T*>(this);
  119. int nConnectionIndex;
  120. CComVariant* pvars = new CComVariant[4];
  121. int nConnections = m_vec.GetSize();
  122. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  123. {
  124. pT->Lock();
  125. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  126. pT->Unlock();
  127. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  128. if (pDispatch != NULL)
  129. {
  130. pvars[3] = Button;
  131. pvars[2] = Shift;
  132. pvars[1] = x;
  133. pvars[0] = y;
  134. DISPPARAMS disp = { pvars, NULL, 4, 0 };
  135. pDispatch->Invoke(DISPID_MOUSEDOWN, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  136. }
  137. }
  138. delete[] pvars;
  139. }
  140. VOID Fire_MouseMove(SHORT Button, SHORT Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
  141. {
  142. T* pT = static_cast<T*>(this);
  143. int nConnectionIndex;
  144. CComVariant* pvars = new CComVariant[4];
  145. int nConnections = m_vec.GetSize();
  146. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  147. {
  148. pT->Lock();
  149. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  150. pT->Unlock();
  151. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  152. if (pDispatch != NULL)
  153. {
  154. pvars[3] = Button;
  155. pvars[2] = Shift;
  156. pvars[1] = x;
  157. pvars[0] = y;
  158. DISPPARAMS disp = { pvars, NULL, 4, 0 };
  159. pDispatch->Invoke(DISPID_MOUSEMOVE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  160. }
  161. }
  162. delete[] pvars;
  163. }
  164. VOID Fire_MouseUp(SHORT Button, SHORT Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
  165. {
  166. T* pT = static_cast<T*>(this);
  167. int nConnectionIndex;
  168. CComVariant* pvars = new CComVariant[4];
  169. int nConnections = m_vec.GetSize();
  170. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  171. {
  172. pT->Lock();
  173. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  174. pT->Unlock();
  175. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  176. if (pDispatch != NULL)
  177. {
  178. pvars[3] = Button;
  179. pvars[2] = Shift;
  180. pvars[1] = x;
  181. pvars[0] = y;
  182. DISPPARAMS disp = { pvars, NULL, 4, 0 };
  183. pDispatch->Invoke(DISPID_MOUSEUP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  184. }
  185. }
  186. delete[] pvars;
  187. }
  188. VOID Fire_Error(SHORT Number, BSTR * Description, LONG Scode, BSTR Source, BSTR HelpFile, LONG HelpContext, CHAR * CancelDisplay)
  189. {
  190. T* pT = static_cast<T*>(this);
  191. int nConnectionIndex;
  192. CComVariant* pvars = new CComVariant[7];
  193. int nConnections = m_vec.GetSize();
  194. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  195. {
  196. pT->Lock();
  197. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  198. pT->Unlock();
  199. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  200. if (pDispatch != NULL)
  201. {
  202. pvars[6] = Number;
  203. pvars[5] = Description;
  204. pvars[4] = Scode;
  205. pvars[3] = Source;
  206. pvars[2] = HelpFile;
  207. pvars[1] = HelpContext;
  208. pvars[0] = CancelDisplay;
  209. DISPPARAMS disp = { pvars, NULL, 7, 0 };
  210. pDispatch->Invoke(DISPID_ERROREVENT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  211. }
  212. }
  213. delete[] pvars;
  214. }
  215. VOID Fire_StateChange(MSVidCtlStateList PrevState, MSVidCtlStateList CurrState)
  216. {
  217. T* pT = static_cast<T*>(this);
  218. int nConnectionIndex;
  219. CComVariant* pvars = new CComVariant[2];
  220. int nConnections = m_vec.GetSize();
  221. TRACELSM(TRACE_DETAIL, (dbgDump << "CVidCtl::FireStateChange(" << PrevState << ", " << CurrState << ")"), "");
  222. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  223. {
  224. pT->Lock();
  225. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  226. pT->Unlock();
  227. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  228. if (pDispatch != NULL)
  229. {
  230. pvars[1] = PrevState;
  231. pvars[0] = CurrState;
  232. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  233. pDispatch->Invoke(dispidStateChange, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  234. }
  235. }
  236. delete[] pvars;
  237. }
  238. };
  239. #endif