wifi+定时关机1.0


#include "cv.h"
#include "highgui.h"

#include <iostream>
#include "windows.h"
#include <iostream>
#include <string>
#include <sstream>
#include <stdlib.h>
using namespace std;

void print()
{
	system( "mode con cols=59 lines=25" );//窗口宽度高度
	system( "color 8f" );
	//SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_GREEN);  
	//printf("Hello"); 
	system( "CLS" );
	system( "title All Copyright Reserved by Author of ims" );//设置cmd窗口标题
	cout    << " ╔══════════════════════════╗\n"
		<< " ║                  按序号执行任务                    ║\n"
		<< " ║══════════════════════════║\n"
		<< " ║        WIFI             ║      关机               ║\n"
		<< " ║  1.启用无线网络         ║  11.延时关机(单位分钟)║\n"
		<< " ║  2.停止无线网络         ║  12.取消延时关机任务    ║\n"
		<< " ║  3.显示连接用户         ║  13.定时关机            ║\n"
		<< " ║  4.显示WiFi密码         ║  14.取消延时关机任务    ║\n"
		<< " ║  5.修改WiFi名称         ║  15.查看计划            ║\n"
		<< " ║  6.修改WiFi密码         ║  16.退出                ║\n"
		<< " ║  7.首次使用初始化       ║  17.使用说明            ║\n"
		<< " ║══════════════════════════║\n"
		<< " ║  10.启用摄像头                                     ║\n"
		<< " ╚══════════════════════════╝\n";
}
int main()
{ 
	print();
	string c;
	cout<<"输入任务序号:";
	cin >> c;
	while( c != "0" )
	{
		while( c == "10" )
		{
			cvNamedWindow("Camera");
			CvCapture* capture = cvCreateCameraCapture(0);    //创建并获取摄像设备
			IplImage* frame;
			while(1) 
			{
				frame = cvQueryFrame(capture);    //创建并获取一张摄像截图
				if(!frame) break;        //如果失败终止循环
				cvShowImage("Camera", frame);    //在一个"win"窗口,并当中显示该截图
				int c = cvWaitKey(15);//等待50ms
				if(c>0) //对应esc键值
					break;
			}
			cvReleaseCapture(&capture);        //释放摄像设备
			cvDestroyWindow("Camera");        //释放窗口"win"
			goto loop;
		}
		loop:
		while( c == "11" )
		{ 
			string down="shutdown -s -t ";
			int t;
			cout<<"输入延时关机时间:";
			cin>>t;
			stringstream s;
			s<<t;
			t*=60;
			stringstream ss;
			ss<<t;
			string input;
			ss>>input;
			down+=input;
			const char *shut=down.c_str();
			//cout<<shut<<endl;	
			system(shut);
			string out="分钟后关机。 ";
			string s1;
			s>>s1;
			s1+=out;
			cout<<s1<<endl;	
			cout<<endl;	
			break;

		}		
		while( c == "12" )
		{
			system( "shutdown -a" );
			cout<<"关机任务已经取消。"<<endl;	
			break;
		}
		while( c == "13" )
		{
			stringstream ss1,ss2;
			string down="at ";
			string str=" shutdown -s -t 10";
			int t1,t2;
			string st1,st2;
			cout<<"输入定时关机时间:";
			cin>>t1;
			cin>>t2;
			if(t1>23||t1<0||t2<0||t2>59)
			{
				cout<<"输入正确的24小时制的时间,时与分之间用空格分割。"<<endl;
				continue;
			}
			ss1<<t1;
			ss1>>st1;
			ss2<<t2;
			ss2>>st2;
			down+=st1;
			down+=":";
		    down+=st2;
			down+=str;
			const char *shut=down.c_str();
			//cout<<shut<<endl;	
			system(shut);
			break;
			//system( "time" );
		}
		while( c == "14" )
		{
			system( "at /delete" );
			break;
		}
		while( c == "15" )
		{
			system( "at" );
			break;
		}
	
		while( c == "16" )
		{
			return 0;
		}
		
		while( c == "1" )
		{
			system( "netsh wlan start hostednetwork" );
			break;
		}
		while( c == "2" )
		{
			system( "netsh wlan stop hostednetwork" );
			break;
		}
		while( c == "3" )
		{
			system( "netsh wlan show hostednetwork" );
			break;
		}
		while( c == "4" )
		{
			system( "netsh wlan show hostednetwork security" );
			break;
		}
		while( c == "5" )
		{
			string str="netsh wlan set hostednetwork ssid= ";
			string str1;
			cout<<"输入新wifi名:";
			cin>>str1;
			str+=str1;
			const char *cmd=str.c_str();
			system(cmd );
			break;
		}
		while( c == "6" )
		{
			string str="netsh wlan set hostednetwork key= ";
			string str1;
			cout<<"输入新密码:";
			cin>>str1;
			str+=str1;
			const char *cmd=str.c_str();
			system( cmd );
			break;
		}
		while( c == "7" )
		{
			system( "netsh wlan set hostednetwork mode=allow ssid=default_wifi key=12345678" );
			break;
		}
			while( c == "17" )
		{
			cout<<"wifi:首次使用时,把本地连接设置为共享。";
			break;
		}
		cout<<endl;
		cout<<"输入任务序号:";
		cin >> c;
	}
	return 0;
}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值