20150403循环语句
Posted wzg31796
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了20150403循环语句相关的知识,希望对你有一定的参考价值。
二.结构化程序设计
1.system("tasklist > c:\\\\1.txt"); 把进程表以txt文件形式输出到c盘
2.keybd_event(0x5b,0,0,0); 按下win键
keybd_event(0x5b,0,2,0); 松开win键
3.程序实现浏览器搜索京东并打开
//open 浏览器
//跳到网址
//输入 +搜索
//点击
//关闭浏览器
#include<Windows.h>
#include<stdlib.h>
void open(char *str)
ShellExecuteA(0, "open",str, 0, 0, 3);
void close()
system("taskkill /f /im 360chrome.exe");
void search()
keybd_event('J', 0, 0, 0);//按下
keybd_event('J', 0, 2, 0);//代表松开
keybd_event('I', 0, 0, 0);//按下
keybd_event('I', 0, 2, 0);//代表松开
keybd_event('N', 0, 0, 0);//按下
keybd_event('N', 0, 2, 0);//代表松开
keybd_event('G', 0, 0, 0);//按下
keybd_event('G', 0, 2, 0);//代表松开
keybd_event('D', 0, 0, 0);//按下
keybd_event('D', 0, 2, 0);//代表松开
keybd_event('O', 0, 0, 0);//按下
keybd_event('O', 0, 2, 0);//代表松开
keybd_event('N', 0, 0, 0);//按下
keybd_event('N', 0, 2, 0);//代表松开
keybd_event('G', 0, 0, 0);//按下
keybd_event('G', 0, 2, 0);//代表松开
Sleep(30);
keybd_event('1', 0, 0, 0);//按下
keybd_event('1', 0, 2, 0);//代表松开
Sleep(30);
keybd_event(0x0D, 0, 0, 0);//按下
keybd_event(0x0D, 0, 2, 0);//代表松开
void maxbaidu()
keybd_event(VK_LMENU, 0, 0, 0);//按下
keybd_event(VK_SPACE, 0, 0, 0);//按下
keybd_event('X', 0, 0, 0);//按下
keybd_event('X', 0, 2, 0);//代表松开
keybd_event(VK_SPACE, 0, 2, 0);//代表松开
keybd_event(VK_LMENU, 0, 2, 0);//代表松开
void click()
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, 200 * 65535 / 1366, 400 * 65535 / 768, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
void main()
while (1)
open("http://www.baidu.com");
Sleep(3000);
search();
Sleep(3000);
maxbaidu();
Sleep(1000);
click();
Sleep(5000);
close();
system("pause");
键鼠操作:
#include<Windows.h>
//open 浏览器
//跳到网址
//输入 +搜索
//点击
//关闭浏览器
void main1()
//keybd_event(0x5b, 0, 0, 0);//按下
//keybd_event(0x5b, 0, 2, 0);//代表松开
keybd_event(0x5b, 0, 0, 0);//按下
keybd_event('M', 0, 0, 0);//按下
keybd_event('M', 0, 2, 0);//代表松开
keybd_event(0x5b, 0, 2, 0);//代表松开
void main2()
main1();//全盘最小化
//移动鼠标到40,40这个位置
Sleep(2000);
//移动到某个位置
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, 40 * 65535 / 1366, 40 * 65535 / 768, 0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
九.enum
1.enum:枚举
enum week星期一,星期二,星期三,星期四,星期五,星期六,星期日;
enum week wk=星期日;
if(星期日==wk) printf("yes");
十八.goto:死循环,用法示例:
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
void open360()
ShellExecuteA(0, "open", "\\"C:\\\\Program Files (x86)\\\\360WangPan\\\\360WangPan.exe\\"", 0, 0, 1);
void moveapple()
//创建一个窗口编号变量,寻找360窗口
HWND win = FindWindowA("360WangPanMainDlg", "360云盘");
if (win == NULL)
printf("嗯哼");
int i = 0;
A: if (i < 1980)
SetWindowPos(win, NULL, i, i * 9 / 16, 700, 400, 0);//让窗口慢慢移动
i++;
Sleep(5);
goto A;
SetWindowPos(win, NULL, 0, 0, 700, 400, 0);//恢复原来的位置
B: Sleep(100);
ShowWindow(win, SW_HIDE);
Sleep(100);
ShowWindow(win, SW_SHOW);
goto B;
void close360()
system("taskkill /f /im 360WangPan.exe");
void main()
Sleep(2000);
open360();
Sleep(5000);
moveapple();
Sleep(10000);
close360();
以上是关于20150403循环语句的主要内容,如果未能解决你的问题,请参考以下文章