-
-
Notifications
You must be signed in to change notification settings - Fork 77
/
MouseGlobalHook.h
33 lines (26 loc) · 888 Bytes
/
MouseGlobalHook.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
#pragma once
class MouseGlobalHook
{
public:
MouseGlobalHook(CWindow wndNotify, UINT msgNotify,
int key, bool ctrl, bool alt, bool shift,
std::vector<CString> excludedPrograms);
~MouseGlobalHook();
private:
static DWORD WINAPI MouseHookThreadProxy(void* pParameter);
DWORD MouseHookThread();
static LRESULT CALLBACK LowLevelMouseProcProxy(int nCode, WPARAM wParam, LPARAM lParam);
LRESULT LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam);
bool IsCursorOnExcludedProgram(POINT pt);
static MouseGlobalHook* volatile m_pThis; // for the mouse procedure
CWindow m_wndNotify;
UINT m_msgNotify;
int m_mouseKey;
bool m_ctrlKey, m_altKey, m_shiftKey;
std::vector<CString> m_excludedPrograms;
volatile HANDLE m_mouseHookThread;
DWORD m_mouseHookThreadId;
HANDLE m_mouseHookThreadReadyEvent;
HHOOK m_lowLevelMouseHook;
bool m_mouseDownEventHooked = false;
};