Deskflow 1.27.0.29
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
MSWindowsHook.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2012 - 2016 Synergy App Ltd
4 * SPDX-FileCopyrightText: (C) 2011 Chris Schoeneman
5 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
6 */
7
8#pragma once
9
10#include <stdint.h>
11
12#define WIN32_LEAN_AND_MEAN
13#include <Windows.h>
14
15#define DESKFLOW_MSG_MARK WM_APP + 0x0011 // mark id; <unused>
16#define DESKFLOW_MSG_KEY WM_APP + 0x0012 // vk code; key data
17#define DESKFLOW_MSG_MOUSE_BUTTON WM_APP + 0x0013 // button msg; <unused>
18#define DESKFLOW_MSG_MOUSE_WHEEL WM_APP + 0x0014 // delta; <unused>
19#define DESKFLOW_MSG_MOUSE_MOVE WM_APP + 0x0015 // x; y
20#define DESKFLOW_MSG_POST_WARP WM_APP + 0x0016 // <unused>; <unused>
21#define DESKFLOW_MSG_PRE_WARP WM_APP + 0x0017 // x; y
22#define DESKFLOW_MSG_SCREEN_SAVER WM_APP + 0x0018 // activated; <unused>
23#define DESKFLOW_MSG_DEBUG WM_APP + 0x0019 // data, data
24#define DESKFLOW_MSG_INPUT_FIRST DESKFLOW_MSG_KEY
25#define DESKFLOW_MSG_INPUT_LAST DESKFLOW_MSG_PRE_WARP
26#define DESKFLOW_HOOK_LAST_MSG DESKFLOW_MSG_DEBUG
27
28#define DESKFLOW_HOOK_FAKE_INPUT_VIRTUAL_KEY VK_CANCEL
29#define DESKFLOW_HOOK_FAKE_INPUT_SCANCODE 0
30
37
44
47{
48public:
49 static constexpr int kVirtualKeyCount = 256;
50
51 MSWindowsHook() = default;
53
54 void loadLibrary();
55
56 int init(DWORD threadID);
57
58 int cleanup();
59
60 void setSides(uint32_t sides);
61 uint32_t getSides();
62
63 void setZone(int32_t x, int32_t y, int32_t w, int32_t h, int32_t jumpZoneSize);
64
65 void setMode(EHookMode mode);
66
68 static bool getPhysicalKeyState(BYTE keys[kVirtualKeyCount]);
69
70 static EHookResult install();
71
72 static int uninstall();
73
74 static int installScreenSaver();
75
76 static int uninstallScreenSaver();
77};
static const WSAEVENT FAR DWORD
Definition ArchNetworkWinsock.cpp:56
EHookMode
Definition MSWindowsHook.h:39
@ kHOOK_WATCH_JUMP_ZONE
Definition MSWindowsHook.h:41
@ kHOOK_DISABLE
Definition MSWindowsHook.h:40
@ kHOOK_RELAY_EVENTS
Definition MSWindowsHook.h:42
EHookResult
Definition MSWindowsHook.h:32
@ kHOOK_FAILED
Definition MSWindowsHook.h:33
@ kHOOK_OKAY_LL
Definition MSWindowsHook.h:35
@ kHOOK_OKAY
Definition MSWindowsHook.h:34
void setMode(EHookMode mode)
Definition MSWindowsHook.cpp:143
void setZone(int32_t x, int32_t y, int32_t w, int32_t h, int32_t jumpZoneSize)
Definition MSWindowsHook.cpp:134
void loadLibrary()
Definition MSWindowsHook.cpp:59
int cleanup()
Definition MSWindowsHook.cpp:115
static int uninstallScreenSaver()
Definition MSWindowsHook.cpp:767
static bool getPhysicalKeyState(BYTE keys[kVirtualKeyCount])
Copy the hook's physical key state; false until it has observed an event.
Definition MSWindowsHook.cpp:152
uint32_t getSides()
Definition MSWindowsHook.cpp:129
static constexpr int kVirtualKeyCount
Definition MSWindowsHook.h:49
static int installScreenSaver()
Definition MSWindowsHook.cpp:749
void setSides(uint32_t sides)
Definition MSWindowsHook.cpp:124
static EHookResult install()
Definition MSWindowsHook.cpp:650
int init(DWORD threadID)
Definition MSWindowsHook.cpp:73
static int uninstall()
Definition MSWindowsHook.cpp:704
MSWindowsHook()=default