• 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方式实现从(1000500-->(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语句将窗体从(0500-->(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、从(00-->(1000,0)。使用for循环的方式

           changePositionFormLeft2Right(win, 0, 0, 1000, 0);

     

           //2、从(1000,0)-->(1000,500),使用while

           changePositionFormRTop2RBottom(win,1000,0,1000,500);

     

           //3dowhile方式实现从(1000500-->(0,500)

           changePositionFormRBoottom2LBottom(win, 1000, 500, 0,500);

     

           //4、通过goto语句将窗体从(0500-->(0,0)

           changePositionFormLBottom2LTop(win,0, 500,0,0);

     

           //5、通过goto语句将窗体从(00-->(1000,500)

           changePositionFromLTop2RBottom(win, 0, 0, 1000, 500);

       }

       

       system("pause");

       return 0;

    }

  • 相关阅读:
    JavaWeb—监听器
    JavaWeb-权限管理思路分析
    JavaWeb_检查用户是否登录的过滤器
    JavaWeb——字符编码过滤器
    JavaWeb_禁用浏览器缓存的过滤器
    JavaWeb-配置Filter的dispatcher节点
    JavaWeb_创建HttpFilter
    Filter练习一
    JavaWeb_Filter(过滤器)
    homestead 重复出错
  • 原文地址:https://www.cnblogs.com/claireyuancy/p/7275386.html
Copyright © 2020-2023  润新知