-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (36 loc) · 792 Bytes
/
Copy pathmain.cpp
File metadata and controls
42 lines (36 loc) · 792 Bytes
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
#include <Windows.h>
#include <iostream>
using namespace std;
bool is_key_down(char key_char)
{
return GetKeyState(key_char) & 0x8000;
}
void mouseClick()
{
INPUT input = { 0 };
input.type = INPUT_MOUSE;
input.mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
SendInput(1, &input, sizeof(INPUT));
// Simulate a left mouse button up event
input.mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(1, &input, sizeof(INPUT));
}
void do_the_thing()
{
POINT current_mouse_pos;
GetCursorPos(¤t_mouse_pos);
SetCursorPos(200,200);
mouseClick();
SetCursorPos(current_mouse_pos.x,current_mouse_pos.y);
}
int main()
{
while (true)
{
if (is_key_down('Q') and is_key_down('W'))
{
do_the_thing();
}
}
return 0;
}