-
Notifications
You must be signed in to change notification settings - Fork 0
/
Callnot.h
108 lines (77 loc) · 1.93 KB
/
Callnot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*++
Copyright (c) 1999 - 2000 Microsoft Corporation. All Rights Reserved.
Module Name:
callnot.h
Abstract:
Declaration of the CTAPIEventNotification object
--*/
#ifndef __TAPIEventNotification_H__
#define __TAPIEventNotification_H__
#include <tapi3.h>
#include <control.h>
#include <strmif.h>
#define WM_PRIVATETAPIEVENT WM_USER+1713
/////////////////////////////////////////////////////////////////////////////
// CTAPIEventNotification
class CTAPIEventNotification : public ITTAPIEventNotification
{
private:
LONG m_dwRefCount;
public:
// CTAPIEventNotification implements ITTAPIEventNotification
// Declare ITTAPIEventNotification methods here
HRESULT STDMETHODCALLTYPE Event(
TAPI_EVENT TapiEvent,
IDispatch * pEvent
);
// other COM stuff:
public:
//
// constructor
//
CTAPIEventNotification()
{
m_dwRefCount = 1;
}
//
// destructor
//
~CTAPIEventNotification()
{
}
// IUnknown implementation
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject)
{
if (iid == IID_ITTAPIEventNotification)
{
AddRef();
*ppvObject = (void *)this;
return S_OK;
}
if (iid == IID_IUnknown)
{
AddRef();
*ppvObject = (void *)this;
return S_OK;
}
return E_NOINTERFACE;
}
//
// reference counting needs to be thread safe
//
ULONG STDMETHODCALLTYPE AddRef()
{
ULONG l = InterlockedIncrement(&m_dwRefCount);
return l;
}
ULONG STDMETHODCALLTYPE Release()
{
ULONG l = InterlockedDecrement(&m_dwRefCount);
if ( 0 == l)
{
delete this;
}
return l;
}
};
#endif //__TAPIEventNotification_H__