#include <stdlib.h> #include <Windows.h> void openQQ() { ShellExecute(0, "open", ""D:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe"", 0, 0, 1); } void diguiMove(HWND win,double x) { if (x > 1000) return; else { SetWindowPos(win, NULL,x , 0.5*x , 500, 500, 0); diguiMove(win, x + 0.4); } } void moveQQ() { //根据类名标题寻找窗口 HWND win = FindWindowA("TXGuiFoundation", "QQ"); if (win == NULL) { printf("QQ失踪"); } for (double i = 0; i < 1000; i+=0.1) { SetWindowPos(win, NULL, i, 0, 500, 500, 0); } double j = 0; while (j < 500) { SetWindowPos(win, NULL, 1000, j, 500, 500, 0); j += 0.1; } double k = 1000; do { SetWindowPos(win, NULL, k , 500, 500, 500, 0); k -= 0.1; } while (k>=0); double t = 500; AAAA: if (t >= 0) { SetWindowPos(win, NULL, 0, t, 500, 500, 0); t -= 0.1; goto AAAA; } diguiMove(win, 0); } void main() { openQQ(); Sleep(2000); moveQQ(); getchar(); }