完整版的鼠标连点器 C++源码
完整版的鼠标连点器。可以据此实现按键精灵的所有操作。程序采用C++编写,用到了多线程操作,可完美实现后台鼠标连点。#include <iostream>
#include <thread>
#include <windows.h>
using namespace std;
void mouse_keep_click()
{
POINT p;
HWND hdc;
while (1){
if (GetAsyncKeyState(VK_UP) & 0x8000){
cout<<"鼠标点击开始!"<<endl;
GetCursorPos(&p);
hdc = WindowFromPoint(p);
ScreenToClient(hdc, &p);
while(1){
PostMessage(hdc,WM_LBUTTONDOWN,MK_LBUTTON,MAKELONG(p.x,p.y));
Sleep(10);
PostMessage(hdc,WM_LBUTTONUP,0,MAKELONG(p.x,p.y));
if (GetAsyncKeyState(VK_DOWN) & 0x8000){
cout << "鼠标点击结束!" << endl;
break;
}
}
}
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000){
cout << "程序结束!" << endl;
break;
}
Sleep(20);
}
}
int main()
{
cout << "鼠标连击程序开始启动...." << endl;
cout << "UP启动当前位置鼠标连击,DOWN关闭鼠标连击;ESC退出程序。" << endl;
thread t1 (mouse_keep_click);
t1.join();
return 0;
}
页:
[1]