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.

846 lines
23 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FXSCOMEXCP.h
  5. Abstract:
  6. ATL's implementation of IConnectionPoint Ifc.
  7. Generated by ATL's Wizard.
  8. Author:
  9. Iv Garber (IvG) Jul, 2000
  10. Revision History:
  11. --*/
  12. #ifndef _FXSCOMEXCP_H_
  13. #define _FXSCOMEXCP_H_
  14. template <class T>
  15. class CProxyIFaxServerNotify : public IConnectionPointImpl<T, &DIID_IFaxServerNotify, CComDynamicUnkArray>
  16. {
  17. //Warning this class may be recreated by the wizard.
  18. public:
  19. HRESULT Fire_OnIncomingJobAdded(IFaxServer * pFaxServer, BSTR bstrJobId)
  20. {
  21. CComVariant varResult;
  22. T* pT = static_cast<T*>(this);
  23. int nConnectionIndex;
  24. int nConnections = m_vec.GetSize();
  25. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  26. if (!pvars)
  27. {
  28. return E_OUTOFMEMORY;
  29. }
  30. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  31. {
  32. pT->Lock();
  33. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  34. pT->Unlock();
  35. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  36. if (pDispatch != NULL)
  37. {
  38. VariantClear(&varResult);
  39. pvars[1] = pFaxServer;
  40. pvars[0] = bstrJobId;
  41. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  42. pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  43. }
  44. }
  45. delete[] pvars;
  46. return varResult.scode;
  47. }
  48. HRESULT Fire_OnIncomingJobRemoved(IFaxServer * pFaxServer, BSTR bstrJobId)
  49. {
  50. CComVariant varResult;
  51. T* pT = static_cast<T*>(this);
  52. int nConnectionIndex;
  53. int nConnections = m_vec.GetSize();
  54. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  55. if (!pvars)
  56. {
  57. return E_OUTOFMEMORY;
  58. }
  59. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  60. {
  61. pT->Lock();
  62. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  63. pT->Unlock();
  64. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  65. if (pDispatch != NULL)
  66. {
  67. VariantClear(&varResult);
  68. pvars[1] = pFaxServer;
  69. pvars[0] = bstrJobId;
  70. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  71. pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  72. }
  73. }
  74. delete[] pvars;
  75. return varResult.scode;
  76. }
  77. HRESULT Fire_OnIncomingJobChanged(IFaxServer * pFaxServer, BSTR bstrJobId, IFaxJobStatus * pJobStatus)
  78. {
  79. CComVariant varResult;
  80. T* pT = static_cast<T*>(this);
  81. int nConnectionIndex;
  82. int nConnections = m_vec.GetSize();
  83. CComVariant* pvars = new (std::nothrow) CComVariant[3];
  84. if (!pvars)
  85. {
  86. return E_OUTOFMEMORY;
  87. }
  88. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  89. {
  90. pT->Lock();
  91. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  92. pT->Unlock();
  93. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  94. if (pDispatch != NULL)
  95. {
  96. VariantClear(&varResult);
  97. pvars[2] = pFaxServer;
  98. pvars[1] = bstrJobId;
  99. pvars[0] = pJobStatus;
  100. DISPPARAMS disp = { pvars, NULL, 3, 0 };
  101. pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  102. }
  103. }
  104. delete[] pvars;
  105. return varResult.scode;
  106. }
  107. HRESULT Fire_OnOutgoingJobAdded(IFaxServer * pFaxServer, BSTR bstrJobId)
  108. {
  109. CComVariant varResult;
  110. T* pT = static_cast<T*>(this);
  111. int nConnectionIndex;
  112. int nConnections = m_vec.GetSize();
  113. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  114. if (!pvars)
  115. {
  116. return E_OUTOFMEMORY;
  117. }
  118. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  119. {
  120. pT->Lock();
  121. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  122. pT->Unlock();
  123. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  124. if (pDispatch != NULL)
  125. {
  126. VariantClear(&varResult);
  127. pvars[1] = pFaxServer;
  128. pvars[0] = bstrJobId;
  129. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  130. pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  131. }
  132. }
  133. delete[] pvars;
  134. return varResult.scode;
  135. }
  136. HRESULT Fire_OnOutgoingJobRemoved(IFaxServer * pFaxServer, BSTR bstrJobId)
  137. {
  138. CComVariant varResult;
  139. T* pT = static_cast<T*>(this);
  140. int nConnectionIndex;
  141. int nConnections = m_vec.GetSize();
  142. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  143. if (!pvars)
  144. {
  145. return E_OUTOFMEMORY;
  146. }
  147. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  148. {
  149. pT->Lock();
  150. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  151. pT->Unlock();
  152. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  153. if (pDispatch != NULL)
  154. {
  155. VariantClear(&varResult);
  156. pvars[1] = pFaxServer;
  157. pvars[0] = bstrJobId;
  158. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  159. pDispatch->Invoke(0x5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  160. }
  161. }
  162. delete[] pvars;
  163. return varResult.scode;
  164. }
  165. HRESULT Fire_OnOutgoingJobChanged(IFaxServer * pFaxServer, BSTR bstrJobId, IFaxJobStatus * pJobStatus)
  166. {
  167. CComVariant varResult;
  168. T* pT = static_cast<T*>(this);
  169. int nConnectionIndex;
  170. int nConnections = m_vec.GetSize();
  171. CComVariant* pvars = new (std::nothrow) CComVariant[3];
  172. if (!pvars)
  173. {
  174. return E_OUTOFMEMORY;
  175. }
  176. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  177. {
  178. pT->Lock();
  179. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  180. pT->Unlock();
  181. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  182. if (pDispatch != NULL)
  183. {
  184. VariantClear(&varResult);
  185. pvars[2] = pFaxServer;
  186. pvars[1] = bstrJobId;
  187. pvars[0] = pJobStatus;
  188. DISPPARAMS disp = { pvars, NULL, 3, 0 };
  189. pDispatch->Invoke(0x6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  190. }
  191. }
  192. delete[] pvars;
  193. return varResult.scode;
  194. }
  195. HRESULT Fire_OnIncomingMessageAdded(IFaxServer * pFaxServer, BSTR bstrMessageId)
  196. {
  197. CComVariant varResult;
  198. T* pT = static_cast<T*>(this);
  199. int nConnectionIndex;
  200. int nConnections = m_vec.GetSize();
  201. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  202. if (!pvars)
  203. {
  204. return E_OUTOFMEMORY;
  205. }
  206. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  207. {
  208. pT->Lock();
  209. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  210. pT->Unlock();
  211. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  212. if (pDispatch != NULL)
  213. {
  214. VariantClear(&varResult);
  215. pvars[1] = pFaxServer;
  216. pvars[0] = bstrMessageId;
  217. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  218. pDispatch->Invoke(0x7, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  219. }
  220. }
  221. delete[] pvars;
  222. return varResult.scode;
  223. }
  224. HRESULT Fire_OnIncomingMessageRemoved(IFaxServer * pFaxServer, BSTR bstrMessageId)
  225. {
  226. CComVariant varResult;
  227. T* pT = static_cast<T*>(this);
  228. int nConnectionIndex;
  229. int nConnections = m_vec.GetSize();
  230. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  231. if (!pvars)
  232. {
  233. return E_OUTOFMEMORY;
  234. }
  235. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  236. {
  237. pT->Lock();
  238. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  239. pT->Unlock();
  240. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  241. if (pDispatch != NULL)
  242. {
  243. VariantClear(&varResult);
  244. pvars[1] = pFaxServer;
  245. pvars[0] = bstrMessageId;
  246. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  247. pDispatch->Invoke(0x8, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  248. }
  249. }
  250. delete[] pvars;
  251. return varResult.scode;
  252. }
  253. HRESULT Fire_OnOutgoingMessageAdded(IFaxServer * pFaxServer, BSTR bstrMessageId)
  254. {
  255. CComVariant varResult;
  256. T* pT = static_cast<T*>(this);
  257. int nConnectionIndex;
  258. int nConnections = m_vec.GetSize();
  259. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  260. if (!pvars)
  261. {
  262. return E_OUTOFMEMORY;
  263. }
  264. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  265. {
  266. pT->Lock();
  267. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  268. pT->Unlock();
  269. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  270. if (pDispatch != NULL)
  271. {
  272. VariantClear(&varResult);
  273. pvars[1] = pFaxServer;
  274. pvars[0] = bstrMessageId;
  275. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  276. pDispatch->Invoke(0x9, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  277. }
  278. }
  279. delete[] pvars;
  280. return varResult.scode;
  281. }
  282. HRESULT Fire_OnOutgoingMessageRemoved(IFaxServer * pFaxServer, BSTR bstrMessageId)
  283. {
  284. CComVariant varResult;
  285. T* pT = static_cast<T*>(this);
  286. int nConnectionIndex;
  287. int nConnections = m_vec.GetSize();
  288. CComVariant* pvars = new (std::nothrow) CComVariant[2];
  289. if (!pvars)
  290. {
  291. return E_OUTOFMEMORY;
  292. }
  293. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  294. {
  295. pT->Lock();
  296. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  297. pT->Unlock();
  298. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  299. if (pDispatch != NULL)
  300. {
  301. VariantClear(&varResult);
  302. pvars[1] = pFaxServer;
  303. pvars[0] = bstrMessageId;
  304. DISPPARAMS disp = { pvars, NULL, 2, 0 };
  305. pDispatch->Invoke(0xa, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  306. }
  307. }
  308. delete[] pvars;
  309. return varResult.scode;
  310. }
  311. HRESULT Fire_OnReceiptOptionsChange(IFaxServer * pFaxServer)
  312. {
  313. CComVariant varResult;
  314. T* pT = static_cast<T*>(this);
  315. int nConnectionIndex;
  316. int nConnections = m_vec.GetSize();
  317. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  318. if (!pvars)
  319. {
  320. return E_OUTOFMEMORY;
  321. }
  322. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  323. {
  324. pT->Lock();
  325. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  326. pT->Unlock();
  327. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  328. if (pDispatch != NULL)
  329. {
  330. VariantClear(&varResult);
  331. pvars[0] = pFaxServer;
  332. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  333. pDispatch->Invoke(0xb, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  334. }
  335. }
  336. delete[] pvars;
  337. return varResult.scode;
  338. }
  339. HRESULT Fire_OnActivityLoggingConfigChange(IFaxServer * pFaxServer)
  340. {
  341. CComVariant varResult;
  342. T* pT = static_cast<T*>(this);
  343. int nConnectionIndex;
  344. int nConnections = m_vec.GetSize();
  345. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  346. if (!pvars)
  347. {
  348. return E_OUTOFMEMORY;
  349. }
  350. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  351. {
  352. pT->Lock();
  353. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  354. pT->Unlock();
  355. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  356. if (pDispatch != NULL)
  357. {
  358. VariantClear(&varResult);
  359. pvars[0] = pFaxServer;
  360. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  361. pDispatch->Invoke(0xc, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  362. }
  363. }
  364. delete[] pvars;
  365. return varResult.scode;
  366. }
  367. HRESULT Fire_OnSecurityConfigChange(IFaxServer * pFaxServer)
  368. {
  369. CComVariant varResult;
  370. T* pT = static_cast<T*>(this);
  371. int nConnectionIndex;
  372. int nConnections = m_vec.GetSize();
  373. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  374. if (!pvars)
  375. {
  376. return E_OUTOFMEMORY;
  377. }
  378. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  379. {
  380. pT->Lock();
  381. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  382. pT->Unlock();
  383. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  384. if (pDispatch != NULL)
  385. {
  386. VariantClear(&varResult);
  387. pvars[0] = pFaxServer;
  388. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  389. pDispatch->Invoke(0xd, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  390. }
  391. }
  392. delete[] pvars;
  393. return varResult.scode;
  394. }
  395. HRESULT Fire_OnEventLoggingConfigChange(IFaxServer * pFaxServer)
  396. {
  397. CComVariant varResult;
  398. T* pT = static_cast<T*>(this);
  399. int nConnectionIndex;
  400. int nConnections = m_vec.GetSize();
  401. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  402. if (!pvars)
  403. {
  404. return E_OUTOFMEMORY;
  405. }
  406. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  407. {
  408. pT->Lock();
  409. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  410. pT->Unlock();
  411. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  412. if (pDispatch != NULL)
  413. {
  414. VariantClear(&varResult);
  415. pvars[0] = pFaxServer;
  416. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  417. pDispatch->Invoke(0xe, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  418. }
  419. }
  420. delete[] pvars;
  421. return varResult.scode;
  422. }
  423. HRESULT Fire_OnOutgoingQueueConfigChange(IFaxServer * pFaxServer)
  424. {
  425. CComVariant varResult;
  426. T* pT = static_cast<T*>(this);
  427. int nConnectionIndex;
  428. int nConnections = m_vec.GetSize();
  429. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  430. if (!pvars)
  431. {
  432. return E_OUTOFMEMORY;
  433. }
  434. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  435. {
  436. pT->Lock();
  437. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  438. pT->Unlock();
  439. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  440. if (pDispatch != NULL)
  441. {
  442. VariantClear(&varResult);
  443. pvars[0] = pFaxServer;
  444. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  445. pDispatch->Invoke(0xf, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  446. }
  447. }
  448. delete[] pvars;
  449. return varResult.scode;
  450. }
  451. HRESULT Fire_OnOutgoingArchiveConfigChange(IFaxServer * pFaxServer)
  452. {
  453. CComVariant varResult;
  454. T* pT = static_cast<T*>(this);
  455. int nConnectionIndex;
  456. int nConnections = m_vec.GetSize();
  457. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  458. if (!pvars)
  459. {
  460. return E_OUTOFMEMORY;
  461. }
  462. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  463. {
  464. pT->Lock();
  465. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  466. pT->Unlock();
  467. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  468. if (pDispatch != NULL)
  469. {
  470. VariantClear(&varResult);
  471. pvars[0] = pFaxServer;
  472. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  473. pDispatch->Invoke(0x10, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  474. }
  475. }
  476. delete[] pvars;
  477. return varResult.scode;
  478. }
  479. HRESULT Fire_OnIncomingArchiveConfigChange(IFaxServer * pFaxServer)
  480. {
  481. CComVariant varResult;
  482. T* pT = static_cast<T*>(this);
  483. int nConnectionIndex;
  484. int nConnections = m_vec.GetSize();
  485. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  486. if (!pvars)
  487. {
  488. return E_OUTOFMEMORY;
  489. }
  490. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  491. {
  492. pT->Lock();
  493. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  494. pT->Unlock();
  495. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  496. if (pDispatch != NULL)
  497. {
  498. VariantClear(&varResult);
  499. pvars[0] = pFaxServer;
  500. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  501. pDispatch->Invoke(0x11, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  502. }
  503. }
  504. delete[] pvars;
  505. return varResult.scode;
  506. }
  507. HRESULT Fire_OnDevicesConfigChange(IFaxServer * pFaxServer)
  508. {
  509. CComVariant varResult;
  510. T* pT = static_cast<T*>(this);
  511. int nConnectionIndex;
  512. int nConnections = m_vec.GetSize();
  513. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  514. if (!pvars)
  515. {
  516. return E_OUTOFMEMORY;
  517. }
  518. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  519. {
  520. pT->Lock();
  521. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  522. pT->Unlock();
  523. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  524. if (pDispatch != NULL)
  525. {
  526. VariantClear(&varResult);
  527. pvars[0] = pFaxServer;
  528. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  529. pDispatch->Invoke(0x12, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  530. }
  531. }
  532. delete[] pvars;
  533. return varResult.scode;
  534. }
  535. HRESULT Fire_OnOutboundRoutingGroupsConfigChange(IFaxServer * pFaxServer)
  536. {
  537. CComVariant varResult;
  538. T* pT = static_cast<T*>(this);
  539. int nConnectionIndex;
  540. int nConnections = m_vec.GetSize();
  541. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  542. if (!pvars)
  543. {
  544. return E_OUTOFMEMORY;
  545. }
  546. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  547. {
  548. pT->Lock();
  549. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  550. pT->Unlock();
  551. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  552. if (pDispatch != NULL)
  553. {
  554. VariantClear(&varResult);
  555. pvars[0] = pFaxServer;
  556. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  557. pDispatch->Invoke(0x13, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  558. }
  559. }
  560. delete[] pvars;
  561. return varResult.scode;
  562. }
  563. HRESULT Fire_OnOutboundRoutingRulesConfigChange(IFaxServer * pFaxServer)
  564. {
  565. CComVariant varResult;
  566. T* pT = static_cast<T*>(this);
  567. int nConnectionIndex;
  568. int nConnections = m_vec.GetSize();
  569. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  570. if (!pvars)
  571. {
  572. return E_OUTOFMEMORY;
  573. }
  574. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  575. {
  576. pT->Lock();
  577. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  578. pT->Unlock();
  579. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  580. if (pDispatch != NULL)
  581. {
  582. VariantClear(&varResult);
  583. pvars[0] = pFaxServer;
  584. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  585. pDispatch->Invoke(0x14, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  586. }
  587. }
  588. delete[] pvars;
  589. return varResult.scode;
  590. }
  591. HRESULT Fire_OnServerActivityChange(IFaxServer * pFaxServer,
  592. LONG lIncomingMessages,
  593. LONG lRoutingMessages,
  594. LONG lOutgoingMessages,
  595. LONG lQueuedMessages)
  596. {
  597. CComVariant varResult;
  598. T* pT = static_cast<T*>(this);
  599. int nConnectionIndex;
  600. int nConnections = m_vec.GetSize();
  601. CComVariant* pvars = new (std::nothrow) CComVariant[5];
  602. if (!pvars)
  603. {
  604. return E_OUTOFMEMORY;
  605. }
  606. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  607. {
  608. pT->Lock();
  609. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  610. pT->Unlock();
  611. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  612. if (pDispatch != NULL)
  613. {
  614. VariantClear(&varResult);
  615. pvars[4] = pFaxServer;
  616. pvars[3] = lIncomingMessages;
  617. pvars[2] = lRoutingMessages;
  618. pvars[1] = lOutgoingMessages;
  619. pvars[0] = lQueuedMessages;
  620. DISPPARAMS disp = { pvars, NULL, 5, 0 };
  621. pDispatch->Invoke(0x15, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  622. }
  623. }
  624. delete[] pvars;
  625. return varResult.scode;
  626. }
  627. HRESULT Fire_OnQueuesStatusChange( IFaxServer * pFaxServer,
  628. VARIANT_BOOL bOutgoingQueueBlocked,
  629. VARIANT_BOOL bOutgoingQueuePaused,
  630. VARIANT_BOOL bIncomingQueueBlocked)
  631. {
  632. CComVariant varResult;
  633. T* pT = static_cast<T*>(this);
  634. int nConnectionIndex;
  635. int nConnections = m_vec.GetSize();
  636. CComVariant* pvars = new (std::nothrow) CComVariant[4];
  637. if (!pvars)
  638. {
  639. return E_OUTOFMEMORY;
  640. }
  641. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  642. {
  643. pT->Lock();
  644. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  645. pT->Unlock();
  646. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  647. if (pDispatch != NULL)
  648. {
  649. VariantClear(&varResult);
  650. pvars[3] = pFaxServer;
  651. pvars[2] = bOutgoingQueueBlocked;
  652. pvars[1] = bOutgoingQueuePaused;
  653. pvars[0] = bIncomingQueueBlocked;
  654. DISPPARAMS disp = { pvars, NULL, 4, 0 };
  655. pDispatch->Invoke(0x16, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  656. }
  657. }
  658. delete[] pvars;
  659. return varResult.scode;
  660. }
  661. HRESULT Fire_OnNewCall(IFaxServer * pFaxServer, LONG lCallId, LONG lDeviceId, BSTR bstrCallerId)
  662. {
  663. CComVariant varResult;
  664. T* pT = static_cast<T*>(this);
  665. int nConnectionIndex;
  666. int nConnections = m_vec.GetSize();
  667. CComVariant* pvars = new (std::nothrow) CComVariant[4];
  668. if (!pvars)
  669. {
  670. return E_OUTOFMEMORY;
  671. }
  672. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  673. {
  674. pT->Lock();
  675. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  676. pT->Unlock();
  677. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  678. if (pDispatch != NULL)
  679. {
  680. VariantClear(&varResult);
  681. pvars[3] = pFaxServer;
  682. pvars[2] = lCallId;
  683. pvars[1] = lDeviceId;
  684. pvars[0] = bstrCallerId;
  685. DISPPARAMS disp = { pvars, NULL, 4, 0 };
  686. pDispatch->Invoke(0x17, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  687. }
  688. }
  689. delete[] pvars;
  690. return varResult.scode;
  691. }
  692. HRESULT Fire_OnServerShutDown(IFaxServer * pFaxServer)
  693. {
  694. CComVariant varResult;
  695. T* pT = static_cast<T*>(this);
  696. int nConnectionIndex;
  697. int nConnections = m_vec.GetSize();
  698. CComVariant* pvars = new (std::nothrow) CComVariant[1];
  699. if (!pvars)
  700. {
  701. return E_OUTOFMEMORY;
  702. }
  703. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  704. {
  705. pT->Lock();
  706. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  707. pT->Unlock();
  708. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  709. if (pDispatch != NULL)
  710. {
  711. VariantClear(&varResult);
  712. pvars[0] = pFaxServer;
  713. DISPPARAMS disp = { pvars, NULL, 1, 0 };
  714. pDispatch->Invoke(0x18, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  715. }
  716. }
  717. delete[] pvars;
  718. return varResult.scode;
  719. }
  720. HRESULT Fire_OnDeviceStatusChange( IFaxServer * pFaxServer,
  721. LONG lDeviceId,
  722. VARIANT_BOOL bPoweredOff,
  723. VARIANT_BOOL bSending,
  724. VARIANT_BOOL bReceiving,
  725. VARIANT_BOOL bRinging)
  726. {
  727. CComVariant varResult;
  728. T* pT = static_cast<T*>(this);
  729. int nConnectionIndex;
  730. int nConnections = m_vec.GetSize();
  731. CComVariant* pvars = new (std::nothrow) CComVariant[6];
  732. if (!pvars)
  733. {
  734. return E_OUTOFMEMORY;
  735. }
  736. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  737. {
  738. pT->Lock();
  739. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  740. pT->Unlock();
  741. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  742. if (pDispatch != NULL)
  743. {
  744. VariantClear(&varResult);
  745. pvars[5] = pFaxServer;
  746. pvars[4] = lDeviceId;
  747. pvars[3] = bPoweredOff;
  748. pvars[2] = bSending;
  749. pvars[1] = bReceiving;
  750. pvars[0] = bRinging;
  751. DISPPARAMS disp = { pvars, NULL, 6, 0 };
  752. pDispatch->Invoke(0x19, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  753. }
  754. }
  755. delete[] pvars;
  756. return varResult.scode;
  757. }
  758. };
  759. #endif