自己做了个会锁定鼠标或让鼠标乱飞的程序
打开exe会让鼠标指针“不听使唤”
话不多说,直接上代码:
【锁定鼠标】
#define _CRT_SECURE_NO_WARNINGS //strcat()所需
#include<iostream> //输入输出
#include<string> //字符串处理
#include<Windows.h> //Windows系统
#include<thread> //线程
#include<tchar.h> //_T()等
using namespace std; //为了方便
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int main(){
int x = GetSystemMetrics(SM_CXSCREEN);//获取屏幕分辨率x和y,
int y = GetSystemMetrics(SM_CYSCREEN);//将鼠标锁定在屏幕中间
system("color a0");
cout<<"system screen:"<<x<<"×"<<y<<".\n";
cout<<"system mouse will be locked at:"<<x/2<<"-"<<y/2<<"\n";
//cout<<"mouse pos:"<<GetCursorPos(NULL)<<"\n";
cout<<"if you want to quit, press F3.";
Sleep(1000);
system("cls");
system("color 09");
int vol=1;
while(vol==1){
cout<<"哈哈哈,你的鼠标动不了了!!!\n";
cout<<"距离锁定结束还有:\n";
int i=200000;
while (i){
if(KEY_DOWN(VK_F3)){
break;//按F3可以退出
}
SetCursorPos(x/2, y/2);
//Sleep(2);
cout<<"\b\b\b\b\b\b\b"<<i;
i--;
}
system("cls");
vol=MessageBox(NULL,"继续锁定鼠标吗?","tip",MB_OKCANCEL|MB_ICONQUESTION);
if(vol==2)return i;
}
}
下载:>点这里<
【乱搞鼠标】
#define _CRT_SECURE_NO_WARNINGS //strcat()所需
#include<iostream> //输入输出
#include<string> //字符串处理
#include<Windows.h> //Windows系统
#include<thread> //线程
#include<tchar.h> //_T()等
using namespace std; //为了方便
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
int main(){
int x = GetSystemMetrics(SM_CXSCREEN);
int y = GetSystemMetrics(SM_CYSCREEN);
int vol=1;
system("color a0");
cout<<"system screen:"<<x<<"×"<<y<<".\n";
cout<<"your mouse will be random set/0.02sec\n";
//cout<<"mouse pos:"<<GetCursorPos(NULL)<<"\n";
cout<<"if you want to quit, press F3.";
Sleep(1000);
system("cls");
system("color 09");
while(vol==1){
cout<<"哈哈哈,你的鼠标正在乱飞!!!\n";
cout<<"距离乱飞结束还有:\n";
int i=1000;
while (i){
if(KEY_DOWN(VK_F3)){
break;//按F3可以退出
}
SetCursorPos(rand() % x, rand() % y);
Sleep(1);
cout<<"\b\b\b\b\b"<<i;
i--;
}
system("cls");
vol=MessageBox(NULL,"继续乱搞鼠标吗?","tip",MB_OKCANCEL|MB_ICONQUESTION);
if(vol==2)return i;
}
}
下载:>点这里<
温馨提示:如果过程中要退出,请按 [ F3 ] 或 [ Alt ] + [ F4 ]。