1 #include <stdlib.h> 2 #include <Windows.h> 3 #include <stdio.h> 4 #include <math.h> 5 #define PI 3.14159 6 #define R 150 7 8 void main() 9 { 10 //获取窗口 11 HWND hnd = FindWindowA("TXGuiFoundation", "QQ"); 12 if (hnd == NULL) 13 { 14 printf("not find"); 15 exit(0); 16 } 17 //左边圆的圆心 18 int px = 200; 19 int py = 300; 20 21 int state = 0; 22 23 //画圆 24 while (1) 25 { 26 //state == 0 画左边圆 state == 1画右边圆 27 if (state == 0) 28 { 29 state = 1; 30 double angle = 0; 31 int px2, py2; 32 for (int i = 0; i <= 360; i++) 33 { 34 //顺时针画圆 35 px2 = px + R*cos(angle*PI / 180); 36 py2 = py + R*sin(angle*PI / 180); 37 angle = angle + 1; 38 SetWindowPos(hnd, 0, px2, py2, 100, 100, 1); 39 Sleep(10); 40 } 41 angle = 0; 42 } 43 44 if (state == 1) 45 { 46 state = 0; 47 double angle = 0; 48 int px2, py2; 49 for (int i = 0; i <= 360; i++) 50 { 51 //逆时针画圆 52 px2 = px + 2*R - R*cos(angle*PI / 180); 53 py2 = py + R*sin(angle*PI / 180); 54 angle = angle + 1; 55 SetWindowPos(hnd, 0, px2, py2, 100, 100, 1); 56 Sleep(10); 57 } 58 angle = 0; 59 } 60 } 61 system("pause"); 62 }