大家好,我是King34。好久不见,距离我上次登洛谷已经过了3个月了。本作者因为学校问题所以隔了一阵子。这次登录,我自然不会亏待大家。这次,我在家里成功制造了一批的连点器。没错,鼠标连点器!!纯Dev.C++制作!(花了1个星期左右,敲代码烦死了)。但最后,我仍然制作了出来!!难度不大,但用到了许多Windows的东西。制作不易,点个关注,不要白嫖!谢谢!
#include<stdio.h>
#include<windows.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b,c;
cout << "welcome to Mouse connector!/欢迎使用鼠标连点器!" << endl;
cout << "Please select a language!/请选择语言:(Chinese or English Press 1 for Chinese and 2 for English)/选中文按1,选英文按2" << endl;
cin >> c;
if(c == 2)
{
system("title Mouse connector");
cout << "Press the space bar to execute this product, press ESC once to end, and press ESC twice to exit the program" << endl;
cout << "MOUSEEVENTF_LEFTDOWN:";
cin >> a;
cout << "MOUSEEVENTF_LEFTUP:";
cin >> b;
cout << "OK,Beginning!" << endl;
while(1)
{
if(GetAsyncKeyState(VK_SPACE))
{
while(1)
{
mouse_event(MOUSEEVENTF_LEFTDOWN,500,500, 0, 0);
Sleep(1000 * a);
mouse_event(MOUSEEVENTF_LEFTUP,500,500, 0, 0);
Sleep(b * 1000);
if(GetAsyncKeyState(VK_ESCAPE))
{
cout << "OK,closed!" << endl;
cout << "This product was invented by author Cai Jinyuan without team assistance.Welcome to use next time!";
return 0;
}
}
}
}
}
if(c == 1)
{
system("title 鼠标连点器");
cout << "本产品按空格键执行,按一次Esc键结束,按二次Esc键退出程序" << endl;
cout << "鼠标左键按下:";
cin >> a;
cout << "鼠标左键抬起:";
cin >> b;
cout << "开始" << endl;
while(1)
{
if(GetAsyncKeyState(VK_SPACE))
{
while(1)
{
mouse_event(MOUSEEVENTF_LEFTDOWN,500,500, 0, 0);
Sleep(1000 * a);
mouse_event(MOUSEEVENTF_LEFTUP,500,500, 0, 0);
Sleep(b * 1000);
if(GetAsyncKeyState(VK_ESCAPE))
{
cout << "好的,关闭" << endl;
cout << "本产品由作者蔡锦源一手发明,无团队协助。欢迎下次使用!再见!";
return 0;
}
}
}
}
}
return 0;
}
其中的Sleep是调整速度的。比如要想1秒点一次,就是Sleep(1000);