diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/omBrowser/browserWndRecord.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/omBrowser/browserWndRecord.cpp')
-rw-r--r-- | Src/omBrowser/browserWndRecord.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/Src/omBrowser/browserWndRecord.cpp b/Src/omBrowser/browserWndRecord.cpp new file mode 100644 index 00000000..b8fae1a1 --- /dev/null +++ b/Src/omBrowser/browserWndRecord.cpp @@ -0,0 +1,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; +} + |