好友
阅读权限10
听众
最后登录1970-1-1
|
阳明呀
发表于 2021-11-5 22:19
本帖最后由 阳明呀 于 2021-11-5 22:22 编辑
采用模拟点击勿喷,效果可以达到
#include <windows.h>
#include <stdio.h>
void click();
void input();
int main(){
HWND hGameWnd = FindWindow(NULL, "QQ");
if (hGameWnd == 0)
{
printf("没有找到该窗口.\n");
getchar();
return 0;
}
//2.通过窗口句柄获取进程ID
unsigned long dwPID = 0;
GetWindowThreadProcessId(hGameWnd, &dwPID);
if (dwPID == 0)
{
printf("获取ID失败.\n");
getchar();
return 0;
}
//3.通过PID获取进程句柄
//打开进程
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPID);
if (hProcess == 0)
{
printf("打开进程失败.\n");
getchar();
return 0;
}
ShowWindow(hGameWnd, SW_RESTORE);//如果界面最小化,将其激活
Sleep(150);
char user[] = "10001";
char pwd [] = "10001";
click(700,460);//这是账号位置
input(user);
click(700,500); //这是密码位置
input(pwd);
printf("ok.\n");
//填写QQ账号(333333)如何填写进去
//填写QQ密码(111111)如何填写进去
system("pause");
return 0;
}
void input(char input_valus []){
int i;
for(i=0;i<sizeof(input_valus[]);i++){
keybd_event(input_valus,0,0,0);
keybd_event(input_valus,0,2,0);
Sleep(100);
}
}
void click(int x, int y)
{
//1400x900电脑分辨率
mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE, x*65535/1400, y*65535/900, 0, 0);
Sleep(50);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);//鼠标左键按下
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);//鼠标左键抬起
} |
|