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.

159 lines
3.0 KiB

  1. // CallNotification.h : Declaration of the CCallNotification
  2. #ifndef __CALLNOTIFICATION_H_
  3. #define __CALLNOTIFICATION_H_
  4. /////////////////////////////////////////////////////////////////////////////
  5. //
  6. // CTAPIEventNotification
  7. //
  8. /////////////////////////////////////////////////////////////////////////////
  9. class CTAPIEventNotification :
  10. public ITTAPIEventNotification
  11. {
  12. private:
  13. LONG m_lRefCount;
  14. public:
  15. CTAPIEventNotification()
  16. {
  17. m_lRefCount = 0;
  18. }
  19. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
  20. {
  21. if (iid == IID_ITTAPIEventNotification)
  22. {
  23. *ppvObject = (void *)this;
  24. AddRef();
  25. return S_OK;
  26. }
  27. if (iid == IID_IUnknown)
  28. {
  29. *ppvObject = (void *)this;
  30. AddRef();
  31. return S_OK;
  32. }
  33. return E_NOINTERFACE;
  34. }
  35. ULONG STDMETHODCALLTYPE AddRef()
  36. {
  37. ULONG l = InterlockedIncrement(&m_lRefCount);
  38. return l;
  39. }
  40. ULONG STDMETHODCALLTYPE Release()
  41. {
  42. ULONG l = InterlockedDecrement(&m_lRefCount);
  43. if ( 0 == l)
  44. {
  45. delete this;
  46. }
  47. return l;
  48. }
  49. // ICallNotification
  50. public:
  51. HRESULT STDMETHODCALLTYPE Event(
  52. TAPI_EVENT TapiEvent,
  53. IDispatch * pEvent
  54. );
  55. };
  56. #ifdef ENABLE_DIGIT_DETECTION_STUFF
  57. /////////////////////////////////////////////////////////////////////////////
  58. //
  59. // CDigitDetectionNotification
  60. //
  61. /////////////////////////////////////////////////////////////////////////////
  62. class CDigitDetectionNotification :
  63. public ITDigitDetectionNotification
  64. {
  65. private:
  66. LONG m_lRefCount;
  67. public:
  68. CDigitDetectionNotification()
  69. {
  70. m_lRefCount = 0;
  71. }
  72. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
  73. {
  74. if (iid == IID_ITDigitDetectionNotification)
  75. {
  76. *ppvObject = (void *)this;
  77. AddRef();
  78. return S_OK;
  79. }
  80. if (iid == IID_IUnknown)
  81. {
  82. *ppvObject = (void *)this;
  83. AddRef();
  84. return S_OK;
  85. }
  86. if (iid == IID_IDispatch)
  87. {
  88. *ppvObject = (void *)this;
  89. AddRef();
  90. return S_OK;
  91. }
  92. return E_NOINTERFACE;
  93. }
  94. ULONG STDMETHODCALLTYPE AddRef()
  95. {
  96. ULONG l = InterlockedIncrement(&m_lRefCount);
  97. return l;
  98. }
  99. ULONG STDMETHODCALLTYPE Release()
  100. {
  101. ULONG l = InterlockedDecrement(&m_lRefCount);
  102. if ( 0 == l)
  103. {
  104. delete this;
  105. }
  106. return l;
  107. }
  108. // ICallNotification
  109. public:
  110. HRESULT STDMETHODCALLTYPE DigitDetected(
  111. unsigned char ucDigit,
  112. TAPI_DIGITMODE DigitMode,
  113. long ulTickCount
  114. );
  115. };
  116. #endif // ENABLE_DIGIT_DETECTION_STUFF
  117. #endif //__CALLNOTIFICATION_H_