Repository navigation
Expand file tree
/
Copy pathhook.cpp
More file actions
102 lines (87 loc) · 2.08 KB
/
Copy pathhook.cpp
File metadata and controls
102 lines (87 loc) · 2.08 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
95
96
97
98
99
100
101
102
#include "btbutton.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "table.h"
#include "free.h"
#include "jindutiaoa.h"
#include "head.h"
static int x1=0;
static int x2=0;
static int ya=0;
static int yb=0;
static POINT XA;
static POINT XB;
extern QStringList Name;
extern QStringList Path;
extern QStandardItemModel* model;
extern QMediaPlayer *player;
extern QMediaPlaylist *playlist;
extern QPushButton *swi;
extern QPushButton *start;
extern int Mode;
extern int Now;
extern int max;
extern QTimer *Time;
extern bool hand;
HHOOK meow=NULL;
LRESULT CALLBACK Hook(int nCode,WPARAM wParam,LPARAM lParam )
{
if(nCode == HC_ACTION)
{
if(lParam==WM_LBUTTONDOWN)
{
GetCursorPos(&XA);
x1=XA.x;
ya=XA.y;
x2=x1;
yb=ya;
}
if(lParam==WM_LBUTTONUP)
{
GetCursorPos(& XB);
x2= XB.x;
yb= XB.y;
if((( x2- x1)>=500)&&(abs( ya- yb)<=300))
{
hand = false;
Free::Skipdown();
hand=true;
}
if((( x2- x1)<=-500)&&(abs( ya- yb)<=300))
{
hand = false;
Free::Skipup();
hand=true;
}
if((( yb- ya)>=500)&&(abs( x1- x2)<=500))
{
Mode++;
if(Mode==4)
{
Mode=0;
}
Free::Modeswitch();
}
if((( yb- ya)<=-500)&&(abs( x1- x2)<=500))
{
Mode--;
if(Mode==-1)
{
Mode=3;
}
Free::Modeswitch();
}
ya=yb;
x1=x2;
}
}
return false;//CallNextHookEx(meow,nCode,wParam,lParam);
}
void MainWindow::Hookset()
{
meow=SetWindowsHookEx( WH_MOUSE_LL,Hook,NULL,0);
}
void MainWindow::Hooknot()
{
UnhookWindowsHookEx(meow);
}