-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
94 lines (83 loc) · 2.76 KB
/
Copy pathmain.cpp
File metadata and controls
94 lines (83 loc) · 2.76 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#define WINVER 0x0500
#include "main.h"
#include <windows.h>
#include "iostream"
__declspec(dllexport) void move_cursorTo(int x, int y)
{
try{
INPUT input={};
input.type = INPUT_MOUSE;
input.mi.mouseData=0;
input.mi.dx = x*(65536/GetSystemMetrics(SM_CXSCREEN));//x being coord in pixels
input.mi.dy = y*(65536/GetSystemMetrics(SM_CYSCREEN));//y being coord in pixels
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
SendInput(1,&input,sizeof(input));
throw true;
}
catch(bool res)
{
//return !res;
}
}
__declspec(dllexport) void click_Left_up(int x,int y)
{
INPUT input={};
input.type = INPUT_MOUSE;
input.mi.mouseData=0;
input.mi.dx = x*(65536/GetSystemMetrics(SM_CXSCREEN));//x being coord in pixels
input.mi.dy = y*(65536/GetSystemMetrics(SM_CYSCREEN));//y being coord in pixels
input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1,&input,sizeof(input));
}
__declspec(dllexport) void click_Left_down(int x, int y)
{
INPUT input={};
input.type = INPUT_MOUSE;
input.mi.mouseData=0;
input.mi.dx = x*(65536/GetSystemMetrics(SM_CXSCREEN));//x being coord in pixels
input.mi.dy = y*(65536/GetSystemMetrics(SM_CYSCREEN));//y being coord in pixels
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN;
SendInput(1,&input,sizeof(input));
//click_Left_up(x,y);
}
__declspec(dllexport) void click_Right_up(int x, int y)
{
INPUT input={};
input.type = INPUT_MOUSE;
input.mi.mouseData=0;
input.mi.dx = x*(65536/GetSystemMetrics(SM_CXSCREEN));//x being coord in pixels
input.mi.dy = y*(65536/GetSystemMetrics(SM_CYSCREEN));//y being coord in pixels
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTUP;
SendInput(1,&input,sizeof(input));
//click_Left_up(x,y);
}
__declspec(dllexport) void click_Right_down(int x, int y)
{
INPUT input={};
input.type = INPUT_MOUSE;
input.mi.mouseData=0;
input.mi.dx = x*(65536/GetSystemMetrics(SM_CXSCREEN));//x being coord in pixels
input.mi.dy = y*(65536/GetSystemMetrics(SM_CYSCREEN));//y being coord in pixels
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_RIGHTDOWN;
SendInput(1,&input,sizeof(input));
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // succesful
}