问题标题: 谁有鼠标连点器的代码

0
0

0
0
李宜和
李宜和
高级启示者
高级启示者

hhh

同吕梓瑜

(我搞的)

0
吕梓瑜
吕梓瑜
初级天翼
初级天翼
#include<iomanip>
#include<stdio.h>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
    srand(time(0)); 
    CONSOLE_CURSOR_INFO info = { 1, 0 };
    HANDLE hand = GetStdHandle( STD_OUTPUT_HANDLE );
    COORD coord={ 0, 0 };
    POINT pt={ 0, 0 };
    SetConsoleCursorInfo( hand, &info );
    std::cout<<"按回车键结束选定";
    while(1){
        SetConsoleCursorPosition( hand, coord );
        GetCursorPos ( &pt );
        std :: cout << pt.x<<','<<pt.y<<std::setw(10)<<"\0"<<std::endl;
        if(GetAsyncKeyState(VK_RETURN)&0x8000){
            break;
        }
    }
    int a,b;
    std::cout<<"请输入x坐标"<<endl; 
    std::cin>>a;
    std::cout<<"请输入y坐标"<<endl; 
    std::cin>>b;
    system("cls");
    std::cout<<"按Tab键结束连点,回车键开始连点";
    Sleep(2000);
    system("cls");
    while(1){
        if(GetAsyncKeyState(VK_RETURN)&0x8000){
            while(1){
                SetCursorPos(a,b);
                mouse_event (MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
                Sleep(1);
                if(GetAsyncKeyState(VK_TAB)&0x09){
                    break;
                }   
            }
            break;
        }   
    }
    return 0;
}

来源:https://wenda.codingtang.com/questions/16777/

我要回答