控制桌面窗口移动(源代码)

196 阅读1分钟

控制应用程序在桌面移动

 

struct pos

{

int x;

int y;

};

struct pos pos1[8] = {  { 1000, 200 }, { 1000, 300 },

{ 200, 600 }, { 660, 400 },

{ 1300, 500 }, {400, 600},

{ 900, 900 }, {1000, 1200}

};

 

void main()

{                                                          //类名                标题

HWND *win = FindWindowA("360WangPan_OriLogin", "360云盘");

//HWND *win = FindWindowA("Notepad", "无标题 - 记事本");

if (win = NULL)

{

return;

}

while (1)

{

for (int i = 0; i < 8; i++)

{

//设置窗口位置 大小

SetWindowPos(win, NULL, pos1[i].x, pos1[i].y, 100, 200, 1);

Sleep(100);

}

}

system("pause");

}

其中的类名和标题来源于,Spy窗口句柄捕捉。