恶搞鼠标追不上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_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()
{
clickbaidu();
return 0;
}
#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;
}
Sleep(1000);
}
}
int main()
{
time_t ts;
srand((unsigned int)time(&ts));
openqq();
Sleep(1000);
changepos();
closeqq();
Sleep(1000);
return 0;
}