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.

761 lines
21 KiB

  1. #ifndef _GUIDESTORECP_H_
  2. #define _GUIDESTORECP_H_
  3. template <class T>
  4. class CProxyIGuideDataProvidersEvents : public IConnectionPointImpl<T, &DIID_IGuideDataProvidersEvents, CComDynamicUnkArray>
  5. {
  6. //Warning this class may be recreated by the wizard.
  7. public:
  8. HRESULT Fire_ItemsChanged()
  9. {
  10. CComVariant varResult;
  11. T* pT = static_cast<T*>(this);
  12. int nConnectionIndex;
  13. int nConnections = m_vec.GetSize();
  14. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  15. {
  16. pT->Lock();
  17. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  18. pT->Unlock();
  19. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  20. if (pDispatch != NULL)
  21. {
  22. VariantClear(&varResult);
  23. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  24. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  25. }
  26. }
  27. return varResult.scode;
  28. }
  29. HRESULT Fire_ItemAdded(IGuideDataProvider * pprovider)
  30. {
  31. CComVariant varResult;
  32. T* pT = static_cast<T*>(this);
  33. int nConnectionIndex;
  34. CComVariant* pvars = new CComVariant[1];
  35. int nConnections = m_vec.GetSize();
  36. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  37. {
  38. pT->Lock();
  39. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  40. pT->Unlock();
  41. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  42. if (pDispatch != NULL)
  43. {
  44. VariantClear(&varResult);
  45. pvars[0] = pprovider;
  46. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  47. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  48. }
  49. }
  50. delete[] pvars;
  51. return varResult.scode;
  52. }
  53. HRESULT Fire_ItemRemoved(long idObj)
  54. {
  55. CComVariant varResult;
  56. T* pT = static_cast<T*>(this);
  57. int nConnectionIndex;
  58. CComVariant* pvars = new CComVariant[1];
  59. int nConnections = m_vec.GetSize();
  60. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  61. {
  62. pT->Lock();
  63. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  64. pT->Unlock();
  65. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  66. if (pDispatch != NULL)
  67. {
  68. VariantClear(&varResult);
  69. pvars[0] = idObj;
  70. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  71. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  72. }
  73. }
  74. delete[] pvars;
  75. return varResult.scode;
  76. }
  77. HRESULT Fire_ItemChanged(IGuideDataProvider * pprovider)
  78. {
  79. CComVariant varResult;
  80. T* pT = static_cast<T*>(this);
  81. int nConnectionIndex;
  82. CComVariant* pvars = new CComVariant[1];
  83. int nConnections = m_vec.GetSize();
  84. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  85. {
  86. pT->Lock();
  87. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  88. pT->Unlock();
  89. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  90. if (pDispatch != NULL)
  91. {
  92. VariantClear(&varResult);
  93. pvars[0] = pprovider;
  94. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  95. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  96. }
  97. }
  98. delete[] pvars;
  99. return varResult.scode;
  100. }
  101. };
  102. template <class T>
  103. class CProxyIProgramsEvents : public IConnectionPointImpl<T, &DIID_IProgramsEvents, CComDynamicUnkArray>
  104. {
  105. //Warning this class may be recreated by the wizard.
  106. public:
  107. HRESULT Fire_ItemsChanged()
  108. {
  109. CComVariant varResult;
  110. T* pT = static_cast<T*>(this);
  111. int nConnectionIndex;
  112. int nConnections = m_vec.GetSize();
  113. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  114. {
  115. pT->Lock();
  116. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  117. pT->Unlock();
  118. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  119. if (pDispatch != NULL)
  120. {
  121. VariantClear(&varResult);
  122. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  123. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  124. }
  125. }
  126. return varResult.scode;
  127. }
  128. HRESULT Fire_ItemAdded(IProgram * pprog)
  129. {
  130. CComVariant varResult;
  131. T* pT = static_cast<T*>(this);
  132. int nConnectionIndex;
  133. CComVariant* pvars = new CComVariant[1];
  134. int nConnections = m_vec.GetSize();
  135. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  136. {
  137. pT->Lock();
  138. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  139. pT->Unlock();
  140. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  141. if (pDispatch != NULL)
  142. {
  143. VariantClear(&varResult);
  144. pvars[0] = pprog;
  145. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  146. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  147. }
  148. }
  149. delete[] pvars;
  150. return varResult.scode;
  151. }
  152. HRESULT Fire_ItemRemoved(long idObj)
  153. {
  154. CComVariant varResult;
  155. T* pT = static_cast<T*>(this);
  156. int nConnectionIndex;
  157. CComVariant* pvars = new CComVariant[1];
  158. int nConnections = m_vec.GetSize();
  159. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  160. {
  161. pT->Lock();
  162. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  163. pT->Unlock();
  164. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  165. if (pDispatch != NULL)
  166. {
  167. VariantClear(&varResult);
  168. pvars[0] = idObj;
  169. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  170. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  171. }
  172. }
  173. delete[] pvars;
  174. return varResult.scode;
  175. }
  176. HRESULT Fire_ItemChanged(IProgram * pprog)
  177. {
  178. CComVariant varResult;
  179. T* pT = static_cast<T*>(this);
  180. int nConnectionIndex;
  181. CComVariant* pvars = new CComVariant[1];
  182. int nConnections = m_vec.GetSize();
  183. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  184. {
  185. pT->Lock();
  186. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  187. pT->Unlock();
  188. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  189. if (pDispatch != NULL)
  190. {
  191. VariantClear(&varResult);
  192. pvars[0] = pprog;
  193. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  194. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  195. }
  196. }
  197. delete[] pvars;
  198. return varResult.scode;
  199. }
  200. };
  201. template <class T>
  202. class CProxyIServicesEvents : public IConnectionPointImpl<T, &DIID_IServicesEvents, CComDynamicUnkArray>
  203. {
  204. //Warning this class may be recreated by the wizard.
  205. public:
  206. HRESULT Fire_ItemsChanged()
  207. {
  208. CComVariant varResult;
  209. T* pT = static_cast<T*>(this);
  210. int nConnectionIndex;
  211. int nConnections = m_vec.GetSize();
  212. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  213. {
  214. pT->Lock();
  215. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  216. pT->Unlock();
  217. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  218. if (pDispatch != NULL)
  219. {
  220. VariantClear(&varResult);
  221. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  222. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  223. }
  224. }
  225. return varResult.scode;
  226. }
  227. HRESULT Fire_ItemAdded(IService * pservice)
  228. {
  229. CComVariant varResult;
  230. T* pT = static_cast<T*>(this);
  231. int nConnectionIndex;
  232. CComVariant* pvars = new CComVariant[1];
  233. int nConnections = m_vec.GetSize();
  234. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  235. {
  236. pT->Lock();
  237. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  238. pT->Unlock();
  239. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  240. if (pDispatch != NULL)
  241. {
  242. VariantClear(&varResult);
  243. pvars[0] = pservice;
  244. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  245. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  246. }
  247. }
  248. delete[] pvars;
  249. return varResult.scode;
  250. }
  251. HRESULT Fire_ItemRemoved(long idObj)
  252. {
  253. CComVariant varResult;
  254. T* pT = static_cast<T*>(this);
  255. int nConnectionIndex;
  256. CComVariant* pvars = new CComVariant[1];
  257. int nConnections = m_vec.GetSize();
  258. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  259. {
  260. pT->Lock();
  261. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  262. pT->Unlock();
  263. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  264. if (pDispatch != NULL)
  265. {
  266. VariantClear(&varResult);
  267. pvars[0] = idObj;
  268. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  269. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  270. }
  271. }
  272. delete[] pvars;
  273. return varResult.scode;
  274. }
  275. HRESULT Fire_ItemChanged(IService * pservice)
  276. {
  277. CComVariant varResult;
  278. T* pT = static_cast<T*>(this);
  279. int nConnectionIndex;
  280. CComVariant* pvars = new CComVariant[1];
  281. int nConnections = m_vec.GetSize();
  282. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  283. {
  284. pT->Lock();
  285. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  286. pT->Unlock();
  287. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  288. if (pDispatch != NULL)
  289. {
  290. VariantClear(&varResult);
  291. pvars[0] = pservice;
  292. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  293. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  294. }
  295. }
  296. delete[] pvars;
  297. return varResult.scode;
  298. }
  299. };
  300. template <class T>
  301. class CProxyIScheduleEntriesEvents : public IConnectionPointImpl<T, &DIID_IScheduleEntriesEvents, CComDynamicUnkArray>
  302. {
  303. //Warning this class may be recreated by the wizard.
  304. public:
  305. HRESULT Fire_ItemsChanged()
  306. {
  307. CComVariant varResult;
  308. T* pT = static_cast<T*>(this);
  309. int nConnectionIndex;
  310. int nConnections = m_vec.GetSize();
  311. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  312. {
  313. pT->Lock();
  314. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  315. pT->Unlock();
  316. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  317. if (pDispatch != NULL)
  318. {
  319. VariantClear(&varResult);
  320. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  321. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  322. }
  323. }
  324. return varResult.scode;
  325. }
  326. HRESULT Fire_ItemAdded(IScheduleEntry * pschedentry)
  327. {
  328. CComVariant varResult;
  329. T* pT = static_cast<T*>(this);
  330. int nConnectionIndex;
  331. CComVariant* pvars = new CComVariant[1];
  332. int nConnections = m_vec.GetSize();
  333. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  334. {
  335. pT->Lock();
  336. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  337. pT->Unlock();
  338. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  339. if (pDispatch != NULL)
  340. {
  341. VariantClear(&varResult);
  342. pvars[0] = pschedentry;
  343. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  344. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  345. }
  346. }
  347. delete[] pvars;
  348. return varResult.scode;
  349. }
  350. HRESULT Fire_ItemRemoved(long idObj)
  351. {
  352. CComVariant varResult;
  353. T* pT = static_cast<T*>(this);
  354. int nConnectionIndex;
  355. CComVariant* pvars = new CComVariant[1];
  356. int nConnections = m_vec.GetSize();
  357. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  358. {
  359. pT->Lock();
  360. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  361. pT->Unlock();
  362. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  363. if (pDispatch != NULL)
  364. {
  365. VariantClear(&varResult);
  366. pvars[0] = idObj;
  367. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  368. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  369. }
  370. }
  371. delete[] pvars;
  372. return varResult.scode;
  373. }
  374. HRESULT Fire_ItemChanged(IScheduleEntry * pschedentry)
  375. {
  376. CComVariant varResult;
  377. T* pT = static_cast<T*>(this);
  378. int nConnectionIndex;
  379. CComVariant* pvars = new CComVariant[1];
  380. int nConnections = m_vec.GetSize();
  381. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  382. {
  383. pT->Lock();
  384. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  385. pT->Unlock();
  386. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  387. if (pDispatch != NULL)
  388. {
  389. VariantClear(&varResult);
  390. pvars[0] = pschedentry;
  391. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  392. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  393. }
  394. }
  395. delete[] pvars;
  396. return varResult.scode;
  397. }
  398. };
  399. template <class T>
  400. class CProxyIChannelLineupsEvents : public IConnectionPointImpl<T, &DIID_IChannelLineupsEvents, CComDynamicUnkArray>
  401. {
  402. //Warning this class may be recreated by the wizard.
  403. public:
  404. HRESULT Fire_ItemsChanged()
  405. {
  406. CComVariant varResult;
  407. T* pT = static_cast<T*>(this);
  408. int nConnectionIndex;
  409. int nConnections = m_vec.GetSize();
  410. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  411. {
  412. pT->Lock();
  413. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  414. pT->Unlock();
  415. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  416. if (pDispatch != NULL)
  417. {
  418. VariantClear(&varResult);
  419. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  420. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  421. }
  422. }
  423. return varResult.scode;
  424. }
  425. HRESULT Fire_ItemAdded(IChannelLineup * pchanlineup)
  426. {
  427. CComVariant varResult;
  428. T* pT = static_cast<T*>(this);
  429. int nConnectionIndex;
  430. CComVariant* pvars = new CComVariant[1];
  431. int nConnections = m_vec.GetSize();
  432. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  433. {
  434. pT->Lock();
  435. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  436. pT->Unlock();
  437. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  438. if (pDispatch != NULL)
  439. {
  440. VariantClear(&varResult);
  441. pvars[0] = pchanlineup;
  442. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  443. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  444. }
  445. }
  446. delete[] pvars;
  447. return varResult.scode;
  448. }
  449. HRESULT Fire_ItemRemoved(long idObj)
  450. {
  451. CComVariant varResult;
  452. T* pT = static_cast<T*>(this);
  453. int nConnectionIndex;
  454. CComVariant* pvars = new CComVariant[1];
  455. int nConnections = m_vec.GetSize();
  456. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  457. {
  458. pT->Lock();
  459. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  460. pT->Unlock();
  461. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  462. if (pDispatch != NULL)
  463. {
  464. VariantClear(&varResult);
  465. pvars[0] = idObj;
  466. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  467. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  468. }
  469. }
  470. delete[] pvars;
  471. return varResult.scode;
  472. }
  473. HRESULT Fire_ItemChanged(IChannelLineup * pchanlineup)
  474. {
  475. CComVariant varResult;
  476. T* pT = static_cast<T*>(this);
  477. int nConnectionIndex;
  478. CComVariant* pvars = new CComVariant[1];
  479. int nConnections = m_vec.GetSize();
  480. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  481. {
  482. pT->Lock();
  483. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  484. pT->Unlock();
  485. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  486. if (pDispatch != NULL)
  487. {
  488. VariantClear(&varResult);
  489. pvars[0] = pchanlineup;
  490. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  491. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  492. }
  493. }
  494. delete[] pvars;
  495. return varResult.scode;
  496. }
  497. };
  498. template <class T>
  499. class CProxyIChannelsEvents : public IConnectionPointImpl<T, &DIID_IChannelsEvents, CComDynamicUnkArray>
  500. {
  501. //Warning this class may be recreated by the wizard.
  502. public:
  503. HRESULT Fire_ItemsChanged()
  504. {
  505. CComVariant varResult;
  506. T* pT = static_cast<T*>(this);
  507. int nConnectionIndex;
  508. int nConnections = m_vec.GetSize();
  509. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  510. {
  511. pT->Lock();
  512. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  513. pT->Unlock();
  514. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  515. if (pDispatch != NULL)
  516. {
  517. VariantClear(&varResult);
  518. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  519. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  520. }
  521. }
  522. return varResult.scode;
  523. }
  524. HRESULT Fire_ItemAdded(IChannel * pchan)
  525. {
  526. CComVariant varResult;
  527. T* pT = static_cast<T*>(this);
  528. int nConnectionIndex;
  529. CComVariant* pvars = new CComVariant[1];
  530. int nConnections = m_vec.GetSize();
  531. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  532. {
  533. pT->Lock();
  534. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  535. pT->Unlock();
  536. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  537. if (pDispatch != NULL)
  538. {
  539. VariantClear(&varResult);
  540. pvars[0] = pchan;
  541. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  542. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  543. }
  544. }
  545. delete[] pvars;
  546. return varResult.scode;
  547. }
  548. HRESULT Fire_ItemRemoved(long idObj)
  549. {
  550. CComVariant varResult;
  551. T* pT = static_cast<T*>(this);
  552. int nConnectionIndex;
  553. CComVariant* pvars = new CComVariant[1];
  554. int nConnections = m_vec.GetSize();
  555. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  556. {
  557. pT->Lock();
  558. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  559. pT->Unlock();
  560. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  561. if (pDispatch != NULL)
  562. {
  563. VariantClear(&varResult);
  564. pvars[0] = idObj;
  565. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  566. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  567. }
  568. }
  569. delete[] pvars;
  570. return varResult.scode;
  571. }
  572. HRESULT Fire_ItemChanged(IChannel * pchan)
  573. {
  574. CComVariant varResult;
  575. T* pT = static_cast<T*>(this);
  576. int nConnectionIndex;
  577. CComVariant* pvars = new CComVariant[1];
  578. int nConnections = m_vec.GetSize();
  579. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  580. {
  581. pT->Lock();
  582. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  583. pT->Unlock();
  584. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  585. if (pDispatch != NULL)
  586. {
  587. VariantClear(&varResult);
  588. pvars[0] = pchan;
  589. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  590. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  591. }
  592. }
  593. delete[] pvars;
  594. return varResult.scode;
  595. }
  596. };
  597. #if 0
  598. template <class T>
  599. class CProxyIObjectsEvents : public IConnectionPointImpl<T, &DIID_IObjectsEvents, CComDynamicUnkArray>
  600. {
  601. //Warning this class may be recreated by the wizard.
  602. public:
  603. HRESULT Fire_ItemsChanged()
  604. {
  605. CComVariant varResult;
  606. T* pT = static_cast<T*>(this);
  607. int nConnectionIndex;
  608. int nConnections = m_vec.GetSize();
  609. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  610. {
  611. pT->Lock();
  612. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  613. pT->Unlock();
  614. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  615. if (pDispatch != NULL)
  616. {
  617. VariantClear(&varResult);
  618. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  619. pDispatch->Invoke(198, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  620. }
  621. }
  622. return varResult.scode;
  623. }
  624. HRESULT Fire_ItemAdded(IUnknown * pobj)
  625. {
  626. CComVariant varResult;
  627. T* pT = static_cast<T*>(this);
  628. int nConnectionIndex;
  629. CComVariant* pvars = new CComVariant[1];
  630. int nConnections = m_vec.GetSize();
  631. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  632. {
  633. pT->Lock();
  634. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  635. pT->Unlock();
  636. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  637. if (pDispatch != NULL)
  638. {
  639. VariantClear(&varResult);
  640. pvars[0] = pobj;
  641. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  642. pDispatch->Invoke(0xc3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  643. }
  644. }
  645. delete[] pvars;
  646. return varResult.scode;
  647. }
  648. HRESULT Fire_ItemRemoved(long idObj)
  649. {
  650. CComVariant varResult;
  651. T* pT = static_cast<T*>(this);
  652. int nConnectionIndex;
  653. CComVariant* pvars = new CComVariant[1];
  654. int nConnections = m_vec.GetSize();
  655. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  656. {
  657. pT->Lock();
  658. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  659. pT->Unlock();
  660. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  661. if (pDispatch != NULL)
  662. {
  663. VariantClear(&varResult);
  664. pvars[0] = idObj;
  665. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  666. pDispatch->Invoke(0xc5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  667. }
  668. }
  669. delete[] pvars;
  670. return varResult.scode;
  671. }
  672. HRESULT Fire_ItemChanged(IUnknown * pobj)
  673. {
  674. CComVariant varResult;
  675. T* pT = static_cast<T*>(this);
  676. int nConnectionIndex;
  677. CComVariant* pvars = new CComVariant[2];
  678. int nConnections = m_vec.GetSize();
  679. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  680. {
  681. pT->Lock();
  682. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  683. pT->Unlock();
  684. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  685. if (pDispatch != NULL)
  686. {
  687. VariantClear(&varResult);
  688. pvars[0] = pobj;
  689. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  690. pDispatch->Invoke(0xc4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  691. }
  692. }
  693. delete[] pvars;
  694. return varResult.scode;
  695. }
  696. };
  697. #endif
  698. #endif