求解,怎样循环?
这是一个QQ循环程序,怎样才能让它进行十字架循环。
#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
void openOrder()
{
ShellExecuteA(0,"open", "\"C:\\Program Files (x86)\\Tencent\\QQ\\Bin\\QQScLauncher.exe\"", 0, 0, 1);
//打开程序运行
}
void closeOrder()
{
system("taskkill /f /im QQ.exe");
//结束运行程序
}
void change()
{
HWND win = FindWindowA("TXGuiFoundation", "QQ");//FindWindowA寻找窗口,根据类名,标题
if (win == NULL)
{
printf("\n获取窗口失败!");
}
SetWindowPos(win, NULL, 0, 0, 500, 470, 0);//设置(2、3)坐标参数,设置(4、5)窗口大小参数
for (;;)
{
//循环
for (int i = 0; i <= 640; i++)
{
SetWindowPos(win, NULL, 0, i, 500, 470, 0);
Sleep(1);
}
for (int i = 0; i <= 1450; i++)
{
SetWindowPos(win, NULL, i, 644, 500, 470, 0);
Sleep(1);
}
for (int i = 640; i >= 0; i--)
{
SetWindowPos(win, NULL, 1450, i, 500, 470, 0);
Sleep(1);
}
for (int i = 1450; i >= 0; i--)
{
SetWindowPos(win, NULL, i, 0, 500, 470, 0);
Sleep(1);
}
}
}
int main()
{
closeOrder();//结束进程
Sleep(1000);//等待1秒
openOrder();//打开进程
Sleep(2000);
change();//设置进行
return 0;
}