恶搞鼠标追不上QQ

来源:互联网 发布:楼梯扶手立柱高度算法 编辑:程序博客网 时间:2024/05/16 17:48

恶搞鼠标追不上QQ

#include <stdio.h>#include <stdlib.h>#include <windows.h>void openbaidu(){    ShellExecuteA(0, "open", "http://www.baidu.com", 0, 0, 3);}void click(){    SetCursorPos(40, 40);//设置鼠标位置    //mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);}int main(){    //openbaidu();    clickbaidu();    return 0;}//鼠标追不上qq#include <stdio.h>#include <stdlib.h>#include <windows.h>#include <time.h>void openqq(){    ShellExecuteA(0, "open", "\"C:\\Program Files (x86)\\Tencent\\TIM\\Bin\\TIM.exe\"", 0, 0, 1);}void closeqq(){    system("taskkill /f /im TIM.exe");}void changepos(){    HWND win = FindWindowA("TXGuiFoundation", "TIM");    while(1){        //        POINT loc;        //获取当前鼠标位置        GetCursorPos(&loc);        int data = rand()%4;        switch (data){            //右下角            case 3:             SetWindowPos(win, NULL, loc.x, loc.y, 500, 400, 0);            break;            //左下角            case 2: SetWindowPos(win, NULL, loc.x-600, loc.y, 500, 400, 0);            break;            //左上角            case 1: SetWindowPos(win, NULL, loc.x, loc.y-350, 500, 400, 0);            break;            //右上角            case 0: SetWindowPos(win, NULL, loc.x-600, loc.y-350, 500, 400, 0);            break;        }        //每隔500ms监测        Sleep(1000);    }}int main(){    time_t ts;    srand((unsigned int)time(&ts));//初始化随机种子    openqq();    Sleep(1000);    changepos();    closeqq();    Sleep(1000);    return 0;}
原创粉丝点击