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
|
#ifndef NULLSOFT_WINAMP_HOOK_HEADER
#define NULLSOFT_WINAMP_HOOK_HEADER
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#include <wtypes.h>
#include <map>
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<UINT, ifc_winamphook*> 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
|