From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/omBrowser/winampHook.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Src/omBrowser/winampHook.h (limited to 'Src/omBrowser/winampHook.h') diff --git a/Src/omBrowser/winampHook.h b/Src/omBrowser/winampHook.h new file mode 100644 index 00000000..c382ef64 --- /dev/null +++ b/Src/omBrowser/winampHook.h @@ -0,0 +1,62 @@ +#ifndef NULLSOFT_WINAMP_HOOK_HEADER +#define NULLSOFT_WINAMP_HOOK_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#include +#include + +class ifc_winamphook; + +class WinampHook +{ +protected: + WinampHook(HWND hwndWinamp); + ~WinampHook(); + +public: + static HRESULT CreateInstance(HWND hwndWinamp, WinampHook **instance); + +public: + ULONG AddRef(); + ULONG Release(); + + HRESULT RegisterCallback(ifc_winamphook *callback, UINT *cookie); + HRESULT UnregisterCallback(UINT cookie); + + HWND GetWinamp(); + LRESULT CallPrevWinampProc(UINT uMsg, WPARAM wParam, LPARAM lParam); + LRESULT CallDefWinampProc(UINT uMsg, WPARAM wParam, LPARAM lParam); + +protected: + HRESULT AttachToWinamp(); + HRESULT DetachFromWinamp(); + LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam); + + LRESULT OnWinampDestroy(); + LRESULT OnWinampIPC(UINT commandId, WPARAM param); + void OnWinampCommand(UINT commandId, UINT controlId, HWND hControl); + void OnSysColorChange(); + +protected: + typedef enum + { + flagUnicode = 0x00000001, + } Flags; + + typedef std::map CallbackMap; + + friend static LRESULT CALLBACK WinampWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +protected: + ULONG ref; + HWND hwnd; + WNDPROC originalProc; + UINT flags; + UINT lastCookie; + CallbackMap callbackMap; +}; + +#endif //NULLSOFT_WINAMP_HOOK_HEADER \ No newline at end of file -- cgit