blob: b8fae1a162aad7c4f9d8ebb6290dc701abdefe6f (
plain) (
blame)
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
|
#include "main.h"
#include "./browserWndRecord.h"
OmBrowserWndRecord::OmBrowserWndRecord(HWND hwnd, const GUID *type)
: ref(1)
{
this->hwnd = hwnd;
this->type = (NULL != type) ? *type : GUID_NULL;
}
OmBrowserWndRecord::~OmBrowserWndRecord()
{
}
HRESULT OmBrowserWndRecord::CreateInstance(HWND hwnd, const GUID *type, OmBrowserWndRecord **instance)
{
if (NULL == instance) return E_POINTER;
if (NULL == hwnd)
{
*instance = NULL;
return E_INVALIDARG;
}
*instance = new OmBrowserWndRecord(hwnd, type);
if (NULL == *instance) return E_OUTOFMEMORY;
return S_OK;
}
ULONG OmBrowserWndRecord::AddRef()
{
return InterlockedIncrement((LONG*)&ref);
}
ULONG OmBrowserWndRecord::Release()
{
if (0 == ref)
return ref;
LONG r = InterlockedDecrement((LONG*)&ref);
if (0 == r)
delete(this);
return r;
}
HWND OmBrowserWndRecord::GetHwnd()
{
return hwnd;
}
HRESULT OmBrowserWndRecord::GetType(GUID *windowType)
{
if (NULL == windowType) return E_POINTER;
*windowType = type;
return S_OK;
}
HRESULT OmBrowserWndRecord::IsEqualType(const GUID *windowType)
{
if (NULL == windowType)
{
return (FALSE != IsEqualGUID(GUID_NULL, type)) ? S_OK : S_FALSE;
}
return (FALSE != IsEqualGUID(*windowType, type)) ? S_OK : S_FALSE;
}
|