1
Good morning, I am making an Autoclick bot for personal use and I would like to add the function of pausing clicks when pressing a specific key but I do not know if it is possible to do this in C++... well, if anyone can help me thank you. Obs Source Code below
#include <iostream>
#include <windows.h>
using namespace std;
int main(int argc, char * argv[]){
    //Declaracao das Variáveis a Serem Usadas <>
    int n = 1;
    int x;
    int y;
    int times;
    int done = 0;
    int sleepy;
    int botao;
    string choice;
    //Fim da Declaração de Variáveis </>
    //Declaração das funcoes a serem utilizadas <>
    void Clicar(int x, int y);
    void ClicarDireito(int x, int y);
    void ClicarMeio(int x, int y);
    void Digitar(char letra);
    //Fim da declaração de funções </>
    start:
//Inicio da coleta de dados <>
cout << "BOT_AutoClick Version 2.1" << endl;
cout << "   " << endl;
cout << "Quantas Vezes Deseja Clicar?" << endl;
cout << " : ";
cin >> times;
cout << "Quanto tempo deve ter entre os click? (Em Milisegundos)" << endl;
cout << "(MS): ";
cin >> sleepy;
cout << "Qual o botao a ser clicado : 1 - left / 2 - middle / 3 - right" <<     endl;
cout << " : ";
do{
cin >> botao;
}while( botao < 1 || botao > 3);
done = 0;
//Fim da Coleta de dados </>
//Contagem Regressiva para posicionar o mouse <>
cout << "starting in 5..." << endl;
Sleep(1000);
cout << "starting in 4..." << endl;
Sleep(1000);
cout << "starting in 3..." << endl;
Sleep(1000);
cout << "starting in 2..." << endl;
Sleep(1000);
cout << "starting in 1..." << endl;
Sleep(1000);
//Fim da Contagem Regressiva para posicionar o mouse </>
//Estrutura de Decisao para clicker C++ <>
if (botao == 1){
    while (done <= times)
    {
        Sleep(sleepy);
        Clicar(x, y); //Para Ver Função do click descer codigo
        done++;
    }
}
if (botao == 2){
        while (done <= times)
    {
        Sleep(sleepy);
        ClicarMeio(x, y); //Para Ver Função do click descer codigo
        done++;
    }
}
    if (botao == 3){
        while (done <= times){
        Sleep(sleepy);
        ClicarDireito(x, y); //Para Ver Função do click descer codigo
        done++;
        }
    }
    //Fim da Estrutura de Decisão do Clicker </>
    cout << "Processo Concluido com Sucesso!." << endl;
    cout << "BOT Autoclick - Criado por Mazurco066." << endl;
    cout << "    " << endl;
    Sleep(1000);
    cout << "Denovo?   sim(y) or nao(n)" << endl;
    cin >> choice;
    if (choice == "y")
    {
        system("cls");
        goto start;
    }
    cin.get();
}
void Clicar(int x, int y){
    mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
}
void ClicarDireito(int x, int y){
    mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
}
void ClicarMeio(int x, int y){
    mouse_event(MOUSEEVENTF_MIDDLEDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_MIDDLEUP, x, y, 0, 0);
}
void Digitar(char letra){
    keybd_event(VkKeyScan(letra),0x9e,0,0);
}
						
vlw guy solved it. I was using another key capture method while waiting but was bad the pause method. thanks msm
– Gabriel Ribeiro