@lysyyds/win32-mouse-keyboard-hook 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -2
- package/build/Release/obj/win32_mouse_keyboard_hook/win32_mo.023EFC9E.tlog/CL.command.1.tlog +0 -0
- package/build/Release/obj/win32_mouse_keyboard_hook/win32_mo.023EFC9E.tlog/link.command.1.tlog +0 -0
- package/build/Release/obj/win32_mouse_keyboard_hook/win32_mouse_keyboard_hook.obj +0 -0
- package/build/Release/obj/win32_mouse_keyboard_hook/win_delay_load_hook.obj +0 -0
- package/build/Release/win32_mouse_keyboard_hook.iobj +0 -0
- package/build/Release/win32_mouse_keyboard_hook.ipdb +0 -0
- package/build/Release/win32_mouse_keyboard_hook.node +0 -0
- package/build/Release/win32_mouse_keyboard_hook.pdb +0 -0
- package/package.json +12 -5
- package/build/Release/win32_mouse_keyboard_hook-v1.0.9-electron-v123-win32-x64.tar.gz +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,107 @@
|
|
|
1
|
-
|
|
1
|
+
## What's this for
|
|
2
|
+
|
|
3
|
+
C++ mouse-keyboard-hook for Electron -> Windows
|
|
4
|
+
|
|
5
|
+
supported Electron verion:
|
|
6
|
+
|
|
7
|
+
- "22.3.27", // 最后一个支持 Win7 的版本
|
|
8
|
+
- "23.3.13",
|
|
9
|
+
- "24.8.3",
|
|
10
|
+
- "25.9.0",
|
|
11
|
+
- "26.2.0",
|
|
12
|
+
- "27.3.0",
|
|
13
|
+
- "28.2.0",
|
|
14
|
+
- "29.4.0",
|
|
15
|
+
- "30.5.1",
|
|
16
|
+
- "31.0.0",
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### install
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
npm i @lysyyds/win32-mouse-keyboard-hook
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### use
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// import
|
|
30
|
+
const win32KeyboardHook = require("@lysyyds/win32-mouse-keyboard-hook");
|
|
31
|
+
// or
|
|
32
|
+
// import win32KeyboardHook from "@lysyyds/win32-mouse-keyboard-hook";
|
|
33
|
+
|
|
34
|
+
// import types
|
|
35
|
+
import type { Callback } from "@lysyyds/win32-mouse-keyboard-hook";
|
|
36
|
+
|
|
37
|
+
const callback: Callback = (type, eventType, x, y) => {
|
|
38
|
+
const [type, eventType, x, y] = args;
|
|
39
|
+
if (type === "key") {
|
|
40
|
+
// keyboard event
|
|
41
|
+
if (eventType == 1) {
|
|
42
|
+
// keydown
|
|
43
|
+
x; // keycode
|
|
44
|
+
} else if (eventType == 2) {
|
|
45
|
+
// keyup
|
|
46
|
+
x; // keycode
|
|
47
|
+
}
|
|
48
|
+
} else if (type === "mouse") {
|
|
49
|
+
x; // mouse position x
|
|
50
|
+
y; // mouse position y
|
|
51
|
+
|
|
52
|
+
if (eventType == 2) {
|
|
53
|
+
// mouse left button down
|
|
54
|
+
} else if (eventType == 3) {
|
|
55
|
+
// mouse left button up
|
|
56
|
+
} else if (eventType == 4) {
|
|
57
|
+
// mouse right button down
|
|
58
|
+
} else if (eventType == 5) {
|
|
59
|
+
// mouse right button up
|
|
60
|
+
} else if (eventType == 6) {
|
|
61
|
+
// wheel active
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
win32KeyboardHook.start(callback);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
types
|
|
71
|
+
``` typescript
|
|
72
|
+
declare module "@lysyyds/win32-mouse-keyboard-hook" {
|
|
73
|
+
export type Callback = (
|
|
74
|
+
type: "key" | "mouse",
|
|
75
|
+
eventType: number,
|
|
76
|
+
x: number,
|
|
77
|
+
y: number,
|
|
78
|
+
) => void;
|
|
79
|
+
|
|
80
|
+
export type CallbackArgs = Parameters<Callback>;
|
|
81
|
+
|
|
82
|
+
export function start(callback: Callback): void;
|
|
83
|
+
export function stop(): void;
|
|
84
|
+
|
|
85
|
+
export enum KeyboardEventType {
|
|
86
|
+
KeyDown = 1,
|
|
87
|
+
KeyUp = 2,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export enum MouseEventType {
|
|
91
|
+
Move = 1,
|
|
92
|
+
LeftDown = 2,
|
|
93
|
+
LeftUp = 3,
|
|
94
|
+
RightDown = 4,
|
|
95
|
+
RightUp = 5,
|
|
96
|
+
Wheel = 6,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Build yourself
|
|
103
|
+
|
|
104
|
+
Before starting, please configure the development environment: desktop development using C++/Windows 10/11 SDK/Python 3, and then run `npm run build`
|
|
2
105
|
|
|
3
106
|
```
|
|
4
107
|
**********************************************************************
|
|
@@ -24,4 +127,4 @@ D:\sourcecode\win32-keyboard-hook>python --version
|
|
|
24
127
|
Python 3.14.2
|
|
25
128
|
|
|
26
129
|
D:\sourcecode\win32-keyboard-hook>npm run build
|
|
27
|
-
```
|
|
130
|
+
```
|
package/build/Release/obj/win32_mouse_keyboard_hook/win32_mo.023EFC9E.tlog/CL.command.1.tlog
CHANGED
|
Binary file
|
package/build/Release/obj/win32_mouse_keyboard_hook/win32_mo.023EFC9E.tlog/link.command.1.tlog
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lysyyds/win32-mouse-keyboard-hook",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "C++ mouse-keyboard-hook for NodeJS & Electron",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "node
|
|
8
|
+
"build-all": "node scripts/prebuild.js",
|
|
9
9
|
"install": "prebuild-install || echo \"skip node build\"",
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
11
|
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/meiguiyisenluo/win32-mouse-keyboard-hook.git"
|
|
15
|
+
},
|
|
12
16
|
"files": [
|
|
13
17
|
"index.js",
|
|
14
18
|
"index.d.ts",
|
|
@@ -29,11 +33,14 @@
|
|
|
29
33
|
"license": "ISC",
|
|
30
34
|
"dependencies": {
|
|
31
35
|
"node-addon-api": "^8.5.0",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
36
|
+
"node-gyp-build": "^4.8.4",
|
|
37
|
+
"prebuild-install": "^7.1.3"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
36
|
-
"
|
|
40
|
+
"install": "^0.13.0",
|
|
41
|
+
"node-abi": "^4.26.0",
|
|
42
|
+
"node-gyp": "^12.2.0",
|
|
43
|
+
"npm": "^11.8.0"
|
|
37
44
|
},
|
|
38
45
|
"exports": {
|
|
39
46
|
".": {
|