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()
//第一个参数是代表系统弹出
//第二个参数是代表执行
//第三个参数执行命令行
//第四个,第五个默认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)
(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
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次
gotoflag;
/*作业题:通过递归的方式实现对角线移动 */
voidchangepositionfromltop2rbottom(hwndwin,intstartx,intstarty,intendx,intendy)
if
(startx ==
endx)
return;
else
= (endy *
startx) /endx;
changepositionfromltop2rbottom(win,startx,starty,endx,endy);
intmain(void)
{
//非作业题
//synchroopen360cloud();
//asynopen360cloud();
//作业题:1.五种循环方式,百度网盘或者阿狸旺旺,控制一下,
//这里以360网盘为例进行测试,电脑分辨率:1366*768
//打开360网盘
open360cloud();
//指针,返回窗口的编号
hwndwin;
//下面的两个参数分别是类名和标题,通过spy工具中的主信息找到
win
=findwindowa("q360cloudloginwnd","360云盘同步版登录");
//第二步:判断是否存在
(win ==
null)
printf("不存在360网盘");
//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;