-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclickthread.cpp
More file actions
44 lines (34 loc) · 1.1 KB
/
clickthread.cpp
File metadata and controls
44 lines (34 loc) · 1.1 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
#include "clickthread.h"
ClickThread::ClickThread(QList<const Click*> clicks) {
this->clicks = clicks;
}
void ClickThread::run() {
POINT pt;
HWND hWnd;
LPARAM lParam;
keybd_event(VkKeyScan('c'), 0, 0, 0);
keybd_event(VkKeyScan('c'), 0, KEYEVENTF_KEYUP, 0);
Sleep(50);
for(int i = 0; i < clicks.length(); i++) {
pt.x = const_cast<Click*>(clicks.at(i))->getX();
pt.y = const_cast<Click*>(clicks.at(i))->getY();
hWnd = WindowFromPoint(pt);
lParam = MAKELPARAM(pt.x, pt.y);
if(const_cast<Click*>(clicks.at(i))->getAlt()) {
keybd_event(VK_MENU, 0, 0, 0);
Sleep(50);
}
PostMessage(hWnd, WM_RBUTTONDOWN, MK_RBUTTON, lParam);
PostMessage(hWnd, WM_RBUTTONUP, MK_RBUTTON, lParam);
if(const_cast<Click*>(clicks.at(i))->getAlt()) {
Sleep(50);
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);
Sleep(50);
}
}
Sleep(50);
keybd_event(VkKeyScan('c'), 0, 0, 0);
keybd_event(VkKeyScan('c'), 0, KEYEVENTF_KEYUP, 0);
}
ClickThread::~ClickThread() {
}