C++ 随机自动舔片器C++;使用一键打开/关闭
我一直在尝试使用headerC++ 随机自动舔片器C++;使用一键打开/关闭,c++,C++,我一直在尝试使用header编写一个cpp自动单击程序,但效果不是最好的。代码运行得很好,但是关闭它非常烦人,因为它需要毫秒的点击,不再需要了,如果我按住快捷键太长时间,它会再次打开。有改进的建议吗 #include <iostream> #include <Windows.h> #include <random> using namespace std; int counti; void menu() { cout << "Press '
编写一个cpp自动单击程序,但效果不是最好的。代码运行得很好,但是关闭它非常烦人,因为它需要毫秒的点击,不再需要了,如果我按住快捷键太长时间,它会再次打开。有改进的建议吗
#include <iostream>
#include <Windows.h>
#include <random>
using namespace std;
int counti;
void menu()
{
cout << "Press 'Ctrl + Tab' to enable and Press 'Ctrl + Tab' to disable randomised autoclicker\n";
}
void clicker()
{
bool click = false; //sets click to false
int n;
while (true)
{
while (1) {
n = rand() % 125;
if (n > 75)break;
}
if (GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_TAB)) //if Ctrl + Tab is pressed
{
counti++;
if (counti % 2 == 1)click = true; //Shortcut pressed once and it activates
else if (counti % 2 == 0)click = false; //Shortcut pressed again and it deactivates
}
if (click == true) // if click = true it will press the mouse button down and up really fast
{
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
cout << n << endl;
Sleep(n); //random speed here
}
}
}
int main()
{
menu();
clicker();
return 0;
}
#包括
#包括
#包括
使用名称空间std;
国际国家;
无效菜单()
{
不能破裂;
}
if(GetAsyncKeyState(VK_控件)&&GetAsyncKeyState(VK_选项卡))//如果按下Ctrl+TAB
{
counti++;
如果(counti%2==1)单击=true;//按下一次快捷键,它就会激活
否则,如果(counti%2==0)单击=false;//再次按下快捷键,它将被停用
}
if(click==true)//如果click=true,它将快速地上下按下鼠标按钮
{
鼠标事件(鼠标事件右下,0,0,0,0);
鼠标事件(鼠标事件右起,0,0,0,0);
不能使用相同的热键打开和关闭。使用不同的键。不要使用相同的热键打开和关闭。使用不同的键。GetAsyncKeyState
非常特殊。阅读文档。GetAsyncKeyState
非常特殊。阅读文档。出于方便,我想使用相同的热键方便,我想使用相同的热键。