QQ窗口的控制,同步异步打开360网盘,控制360网盘窗口的移动
1.通過system啟動(dòng)飛秋進(jìn)程的方式:
2.Windows下殺死進(jìn)程的方式是:taskkill /f/im QQ.exe,截圖如下:
3、控制360網(wǎng)盤的移動(dòng),打開等效果:
#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
?
/************************************************************************/
/*非作業(yè)題:由于沒有百度網(wǎng)盤,這里以360網(wǎng)盤為例做homework,????????????*/
/*以同步的方式打開360?????????????????????????????????????????????????*/
/************************************************************************/
voidsynchroOpen360Cloud()
{
???while (1)
???{
???????//以同步方式打開360網(wǎng)盤,注意:64位 的情況下(x86)要有空格,轉(zhuǎn)義字符
???????system("\"C:\\ProgramFiles (x86)\\360\\360YunPan\\360cloud\\360Cloud.exe\"");
???????Sleep(1000);
???}
}
?
/************************************************************************/
/*非作業(yè)題:以異步的方式打開360網(wǎng)盤???????????????????????????????????*/
/*異步打開窗口使用的是ShellExecuteA函數(shù)???????????????????????????????*/
/************************************************************************/
voidasynOpen360Cloud()
{
???while (1)
???{
???????//第一個(gè)參數(shù)是代表系統(tǒng)彈出
???????//第二個(gè)參數(shù)是代表執(zhí)行
???????//第三個(gè)參數(shù)執(zhí)行命令行
???????//第四個(gè),第五個(gè)默認(rèn)0,
???????//第六個(gè)參數(shù),0代表窗口隱藏,1代表正常,3最大化,6最小化
???????ShellExecuteA(0,"open","\"C:\\ProgramFiles (x86)\\360\\360YunPan\\360cloud\\360Cloud.exe\"", 0, 0, 1);
???????Sleep(5000);
???}
}
?
/************************************************************************/
/*?作業(yè)題:打開360網(wǎng)盤????????????????????????????????????????????????*/
/************************************************************************/
voidopen360Cloud()
{
???ShellExecuteA(0,"open","\"C:\\Program Files(x86)\\360\\360YunPan\\360cloud\\360Cloud.exe\"", 0,0,1);
}
?
/************************************************************************/
/*作業(yè)題:改變網(wǎng)盤的位置,從左到右for循環(huán)方式??????????????????????????*/
/************************************************************************/
voidchangePositionFormLeft2Right(HWNDwin,intstartX,intstartY,intendX,intendY)
{
???for (inti =startX;i <=endX;i+=10)
???{
???????SetWindowPos(win,NULL,i, 0, 300, 400, 1);
???????Sleep(30);
???}
}
?
/************************************************************************/
/*作業(yè)題: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;
???}
}
?
/************************************************************************/
/*作業(yè)題:do while方式實(shí)現(xiàn)從(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);
}
?
/************************************************************************/
/*作業(yè)題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;
???}
}
?
/************************************************************************/
/*作業(yè)題:通過遞歸的方式實(shí)現(xiàn)對(duì)角線移動(dòng)????????????????????????????????????????????????????????????????????*/
/************************************************************************/
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) {???
???//非作業(yè)題
???//synchroOpen360Cloud();
???//asynOpen360Cloud();
?
???//作業(yè)題:1.五種循環(huán)方式,百度網(wǎng)盤或者阿貍旺旺,控制一下,
???//這里以360網(wǎng)盤為例進(jìn)行測(cè)試,電腦分辨率:1366*768
?
???//打開360網(wǎng)盤
???open360Cloud();
?
???//指針,返回窗口的編號(hào)
???HWNDwin;
???//下面的兩個(gè)參數(shù)分別是類名和標(biāo)題,通過spy工具中的主信息找到
???win =FindWindowA("Q360CloudLoginWnd","360云盤同步版登錄");
?
???//第二步:判斷是否存在
???if (win == NULL)
???{
?????? printf("不存在360網(wǎng)盤");
???}
???else
???{
???????//1、從(0,0)-->(1000,0),使用for循環(huán)的方式
???????changePositionFormLeft2Right(win, 0, 0, 1000, 0);
?
???????//2、從(1000,0)-->(1000,500),使用while
???????changePositionFormRTop2RBottom(win,1000,0,1000,500);
?
???????//3、dowhile方式實(shí)現(xiàn)從(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;
}
總結(jié)
以上是生活随笔為你收集整理的QQ窗口的控制,同步异步打开360网盘,控制360网盘窗口的移动的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 治疗牙周炎的药能导致尿酸增高吗(治疗牙周
- 下一篇: 工商银行电子银行承兑汇票怎么接收(电子银