-
Notifications
You must be signed in to change notification settings - Fork 2
/
dd.hpp
75 lines (67 loc) · 1.57 KB
/
dd.hpp
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
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
DD —— 驱动级键鼠操作模拟
http://www.ddxoft.com/help/
*/
#include <stdint.h>
#include <stdbool.h>
#include "windows.h"
HMODULE hMoudle = 0;
bool init() {
const char* DLLPATH = "dd.dll";
hMoudle = LoadLibrary(DLLPATH);
return hMoudle!=NULL;
}
void* getProc(const char* procName) {
if (hMoudle == 0) {
return NULL;
}
return GetProcAddress(hMoudle, procName);
}
int32_t DD_btn(int32_t flag) {
typedef int32_t(*ProcType)(int32_t);
ProcType f = (ProcType)getProc("DD_btn");
if (f == NULL) {
return -1;
}
return f(flag);
}
int32_t DD_mov(int32_t x, int32_t y) {
typedef int32_t(*ProcType)(int32_t, int32_t);
ProcType f = (ProcType)getProc("DD_mov");
if (f == NULL) {
return -1;
}
return f(x, y);
}
int32_t DD_movR(int32_t dx, int32_t dy) {
typedef int32_t(*ProcType)(int32_t, int32_t);
ProcType f = (ProcType)getProc("DD_movR");
if (f == NULL) {
return -1;
}
return f(dx, dy);
}
int32_t DD_whl(int32_t flag) {
typedef int32_t(*ProcType)(int32_t);
ProcType f = (ProcType)getProc("DD_whl");
if (f == NULL) {
return -1;
}
return f(flag);
}
int32_t DD_key(int32_t key, int32_t status) {
typedef int32_t(*ProcType)(int32_t, int32_t);
ProcType f = (ProcType)getProc("DD_key");
if (f == NULL) {
return -1;
}
return f(key, status);
}
int32_t DD_str(const char* str){
typedef int32_t(*ProcType)(const char* );
ProcType f = (ProcType)getProc("DD_str");
if (f == NULL) {
return -1;
}
return f(str);
}