温馨提示:请在Windows下使用

目录:

在包含了Windows.h时,可以用一些函数实现移动鼠标来坑人

函数解释

(蒟蒻靠经验写的,如有错误请百度参考他人

  • POINT类型:用于存放鼠标位置数据
  • GetCursorPos(&p):把鼠标位置读入到POINT型变量p里
  • SetCursorPos(x,y):把鼠标的位置设定为(x,y)

程序实现

鼠标跳动会停版

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
#include<windows.h>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int main()
{
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
ShowOwnedPopups(hwnd,SW_HIDE);
ShowWindow(hwnd,SW_HIDE);
POINT p;double g=2;
int i=1;
int a=GetSystemMetrics(SM_CXSCREEN);
int b=GetSystemMetrics(SM_CYSCREEN);
GetCursorPos(&p);
while(p.y<b-65 && i<=20){
g=0;
while(p.y<b-50){
GetCursorPos(&p);
SetCursorPos(p.x,p.y+g);
_sleep(10);
g+=0.49;
}
g/=1.5;
while(g>0){
GetCursorPos(&p);
SetCursorPos(p.x,p.y-g);
_sleep(10);
g-=0.49;
}
i++;
}
return 0;
}

鼠标跳动不停版

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
#include<windows.h>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int main()
{
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
ShowOwnedPopups(hwnd,SW_HIDE);
ShowWindow(hwnd,SW_HIDE);
POINT p;double g=2;
int i=1;
int a=GetSystemMetrics(SM_CXSCREEN);
int b=GetSystemMetrics(SM_CYSCREEN);
GetCursorPos(&p);
while(1){
g=0;
while(p.y<b-50){
GetCursorPos(&p);
SetCursorPos(p.x,p.y+g);
_sleep(10);
g+=0.49;
}
if(g>7){
g/=1.5;
}else{
g=50;
}
while(g>0){
GetCursorPos(&p);
SetCursorPos(p.x,p.y-g);
_sleep(10);
g-=0.49;
}
}
return 0;
}

鼠标自动跨屏幕工具

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
#include<bits/stdc++.h>
#include<windows.h>
#include<ctime>
using namespace std;
int main(){
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
ShowOwnedPopups(hwnd,SW_HIDE);
ShowWindow(hwnd,SW_HIDE);
POINT p;
int i=1;
int a=GetSystemMetrics(SM_CXSCREEN);
int b=GetSystemMetrics(SM_CYSCREEN);
while(1){
GetCursorPos(&p);
if(p.x>=a-1){
SetCursorPos(1,p.y);
}
if(p.y>=b-1){
SetCursorPos(p.x,1);
}
if(p.x==0){
SetCursorPos(a-1,p.y);
}
if(p.y==0){
SetCursorPos(p.x,b-1);
}
_sleep(10);
}
}

特别感谢:

  • 感谢lukelin告诉我隐藏控制台的代码:
1
2
3
4
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
ShowOwnedPopups(hwnd,SW_HIDE);
ShowWindow(hwnd,SW_HIDE);