QQ窗口的控制,同步异步打开360网盘,控制360网盘窗口的移动
1.通過system啟動飛秋進程的方式:
2.Windows下殺死進程的方式是:taskkill /f/im QQ.exe,截圖如下:
3、控制360網盤的移動,打開等效果:
#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
?
/************************************************************************/
/*非作業題:由于沒有百度網盤,這里以360網盤為例做homework,????????????*/
/*以同步的方式打開360?????????????????????????????????????????????????*/
/************************************************************************/
voidsynchroOpen360Cloud()
{
???while (1)
???{
???????//以同步方式打開360網盤,注意:64位 的情況下(x86)要有空格,轉義字符
???????system("\"C:\\ProgramFiles (x86)\\360\\360YunPan\\360cloud\\360Cloud.exe\"");
???????Sleep(1000);
???}
}
?
/************************************************************************/
/*非作業題:以異步的方式打開360網盤???????????????????????????????????*/
/*異步打開窗口使用的是ShellExecuteA函數???????????????????????????????*/
/************************************************************************/
voidasynOpen360Cloud()
{
???while (1)
???{
???????//第一個參數是代表系統彈出
???????//第二個參數是代表執行
???????//第三個參數執行命令行
???????//第四個,第五個默認0,
???????//第六個參數,0代表窗口隱藏,1代表正常,3最大化,6最小化
???????ShellExecuteA(0,"open","\"C:\\ProgramFiles (x86)\\360\\360YunPan\\360cloud\\360Cloud.exe\"", 0, 0, 1);
???????Sleep(5000);
???}
}
?
/************************************************************************/
/*?作業題:打開360網盤????????????????????????????????????????????????*/
/************************************************************************/
voidopen360Cloud()
{
???ShellExecuteA(0,"open","\"C:\\Program Files(x86)\\360\\360YunPan\\360cloud\\360Cloud.exe\"", 0,0,1);
}
?
/************************************************************************/
/*作業題:改變網盤的位置,從左到右for循環方式??????????????????????????*/
/************************************************************************/
voidchangePositionFormLeft2Right(HWNDwin,intstartX,intstartY,intendX,intendY)
{
???for (inti =startX;i <=endX;i+=10)
???{
???????SetWindowPos(win,NULL,i, 0, 300, 400, 1);
???????Sleep(30);
???}
}
?
/************************************************************************/
/*作業題:while方式 從(1000,0)-->(1000,500),使用while?????????????????*/
/************************************************************************/
voidchangePositionFormRTop2RBottom(HWNDwin,intstartX,intstartY,intendX,intendY)
{
???while (startY <= endY)
???{
???????SetWindowPos(win,NULL,startX,startY, 300, 400, 1);
???????Sleep(30);//休眠30毫秒
???????startY += 10;
???}
}
?
/************************************************************************/
/*作業題:do while方式實現從(1000,500)-->(0,500);????????????????????????????????????????????????????????????????????*/
/************************************************************************/
voidchangePositionFormRBoottom2LBottom(HWNDwin,intstartX,intstartY,intendX,intendY)
{
???do
???{
???????SetWindowPos(win,NULL,startX,startY, 300, 400, 1);
???????Sleep(30);//休眠
???????startX -= 10;
???} while (startX > endX);
}
?
/************************************************************************/
/*作業題1、通過goto語句將窗口從(0,500)-->(0,0)?????????????????????*/
/************************************************************************/
voidchangePositionFormLBottom2LTop(HWNDwin,intstartX,intstartY,intendX,intendY)
{
???flag:if (startY >endY)
???{
???????Sleep(30);//休眠1次
???????startY -= 10;
???????SetWindowPos(win,NULL,startX,startY, 300, 400, 1);
???????gotoflag;
???}
}
?
/************************************************************************/
/*作業題:通過遞歸的方式實現對角線移動????????????????????????????????????????????????????????????????????*/
/************************************************************************/
voidchangePositionFromLTop2RBottom(HWNDwin,intstartX,intstartY,intendX,intendY)
{
???if (startX == endX)
???{
???????return;
???}
???else {
???????startX += 10;
???????startY = (endY * startX) /endX;
???????SetWindowPos(win,NULL,startX,startY, 300, 400, 1);
???????Sleep(30);
???????changePositionFromLTop2RBottom(win,startX,startY,endX,endY);
???}
}
?
intmain(void) {???
???//非作業題
???//synchroOpen360Cloud();
???//asynOpen360Cloud();
?
???//作業題:1.五種循環方式,百度網盤或者阿貍旺旺,控制一下,
???//這里以360網盤為例進行測試,電腦分辨率:1366*768
?
???//打開360網盤
???open360Cloud();
?
???//指針,返回窗口的編號
???HWNDwin;
???//下面的兩個參數分別是類名和標題,通過spy工具中的主信息找到
???win =FindWindowA("Q360CloudLoginWnd","360云盤同步版登錄");
?
???//第二步:判斷是否存在
???if (win == NULL)
???{
?????? printf("不存在360網盤");
???}
???else
???{
???????//1、從(0,0)-->(1000,0),使用for循環的方式
???????changePositionFormLeft2Right(win, 0, 0, 1000, 0);
?
???????//2、從(1000,0)-->(1000,500),使用while
???????changePositionFormRTop2RBottom(win,1000,0,1000,500);
?
???????//3、dowhile方式實現從(1000,500)-->(0,500)
???????changePositionFormRBoottom2LBottom(win, 1000, 500, 0,500);
?
???????//4、通過goto語句將窗口從(0,500)-->(0,0)
???????changePositionFormLBottom2LTop(win,0, 500,0,0);
?
???????//5、通過goto語句將窗口從(0,0)-->(1000,500)
???????changePositionFromLTop2RBottom(win, 0, 0, 1000, 500);
???}
???
???system("pause");
???return 0;
}
總結
以上是生活随笔為你收集整理的QQ窗口的控制,同步异步打开360网盘,控制360网盘窗口的移动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 治疗牙周炎的药能导致尿酸增高吗(治疗牙周
- 下一篇: 递归实现10进制转8进制,字符串数字互转