c# c语言定时关机程序机

这两天突然需要用到自动关机的功能。从网上下了一个工具,没想到用两次居然要注册付费使用,晕倒,这点小功能也要付费啊。索性自己做一个吧!于是今天用C#自己做了一个,在这里晒一下!^_^!自动关机功能很简单,你可以用API实现也可以用Command实现,就像我上篇文章提到的用shutdown.exe来实现,不过缺点是只有XP以上版本的系统才有(我想用2000和98的人已经很少了吧)。于是我就用Command实现吧!先完成一个关机功能的类,这里的一点点技巧就是在C#中运行Command Line程序:
&1&&&&&&&&public&static&void&Shutdown(bool&isCancel,&uint&interval)&2&&&&&&&&{&3&&&&&&&&&&&&Process&proc&=&new&Process();&4&&&&&&&&&&&&proc.StartInfo.FileName&=&"cmd.exe";&//&启动命令行程序&5&&&&&&&&&&&&proc.StartInfo.UseShellExecute&=&false;&//&不使用Shell来执行,用程序来执行&6&&&&&&&&&&&&proc.StartInfo.RedirectStandardError&=&true;&//&重定向标准输入输出&7&&&&&&&&&&&&proc.StartInfo.RedirectStandardInput&=&true;&8&&&&&&&&&&&&proc.StartInfo.RedirectStandardOutput&=&true;&9&&&&&&&&&&&&proc.StartInfo.CreateNoWindow&=&true;&//&执行时不创建新窗口<SPAN style="COLOR: #&&&&&&&&&&&&proc.Start();<SPAN style="COLOR: #<SPAN style="COLOR: #&&&&&&&&&&&&string&commandL<SPAN style="COLOR: #&&&&&&&&&&&&if&(isCancel)<SPAN style="COLOR: #&&&&&&&&&&&&&&&&commandLine&=&@"shutdown&/a";<SPAN style="COLOR: #&&&&&&&&&&&&else<SPAN style="COLOR: #&&&&&&&&&&&&&&&&commandLine&=&@"shutdown&/f&/s&/t&"&+&interval.ToString();<SPAN style="COLOR: #<SPAN style="COLOR: #&&&&&&&&&&&&proc.StandardInput.WriteLine(commandLine);<SPAN style="COLOR: #&&&&&&&&}然后再实现一个延时的功能,这个代码没什么好贴的就是运用DateTime和TimeSpan搞定。为了Cool一点,再加上一个最小化到图标栏的功能,并取消Close的功能。
&1&&&&&&&&private&void&AutoShutDownForm_FormClosing(object&sender,&FormClosingEventArgs&e)&2&&&&&&&&{&3&&&&&&&&&&&&if&(e.CloseReason&!=&CloseReason.ApplicationExitCall)&4&&&&&&&&&&&&{&5&&&&&&&&&&&&&&&&e.Cancel&=&true;&6&&&&&&&&&&&&&&&&this.WindowState&=&FormWindowState.M&7&&&&&&&&&&&&&&&&this.Visible&=&false;&8&&&&&&&&&&&&&&&&notifyIcon.Visible&=&true;&9&&&&&&&&&&&&}<SPAN style="COLOR: #&&&&&&&&}<SPAN style="COLOR: #<SPAN style="COLOR: #&&&&&&&&private&void&notifyIcon_MouseDoubleClick(object&sender,&MouseEventArgs&e)<SPAN style="COLOR: #&&&&&&&&{<SPAN style="COLOR: #&&&&&&&&&&&&this.Visible&=&true;<SPAN style="COLOR: #&&&&&&&&&&&&this.WindowState&=&FormWindowState.N<SPAN style="COLOR: #&&&&&&&&&&&&this.notifyIcon.Visible&=&false;<SPAN style="COLOR: #&&&&&&&&}<SPAN style="COLOR: #在Close的事件处理函数中要注意,&if&(e.CloseReason&!=&CloseReason.ApplicationExitCall) 因为我们取消掉了Close的功能,那么退出程序就用Application.Exit()来实现。最后再给这个程序加上一个Xml配置文件,就完成了^_^!
&1&&&&&&&&&&&&XmlDocument&doc&=&new&XmlDocument();&2&&&&&&&&&&&&if&(!File.Exists(S_CONFIG_FILE))&3&&&&&&&&&&&&{&4&&&&&&&&&&&&&&&&doc.LoadXml("&?xml&version=\"<SPAN style="COLOR: #.0\"&encoding=\"utf-<SPAN style="COLOR: #\"&?&"&5&&&&&&&&&&&&&&&&&&&&&&&&&&&&+&"&Config&"&6&&&&&&&&&&&&&&&&&&&&&&&&&&&&+&"&IntervalTime&"&7&&&&&&&&&&&&&&&&&&&&&&&&&&&&+&"&Hours&&/Hours&"&8&&&&&&&&&&&&&&&&&&&&&&&&&&&&+&"&Minutes&&/Minutes&"&9&&&&&&&&&&&&&&&&&&&&&&&&&&&&+&"&/IntervalTime&"<SPAN style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&&&&&+&"&/Config&");<SPAN style="COLOR: #&&&&&&&&&&&&}<SPAN style="COLOR: #&&&&&&&&&&&&else<SPAN style="COLOR: #&&&&&&&&&&&&{<SPAN style="COLOR: #&&&&&&&&&&&&&&&&doc.Load(S_CONFIG_FILE);<SPAN style="COLOR: #&&&&&&&&&&&&}<SPAN style="COLOR: #<SPAN style="COLOR: #&&&&&&&&&&&&XmlNode&intervalNode&=&doc.DocumentElement.SelectSingleNode(@"IntervalTime");<SPAN style="COLOR: #&&&&&&&&&&&&intervalNode.SelectSingleNode(@"Hours").InnerText&=&s_hours.ToString();<SPAN style="COLOR: #&&&&&&&&&&&&intervalNode.SelectSingleNode(@"Minutes").InnerText&=&s_minutes.ToString();<SPAN style="COLOR: #<SPAN style="COLOR: #&&&&&&&&&&&&XmlTextWriter&xtw&=&new&XmlTextWriter(S_CONFIG_FILE,&null);<SPAN style="COLOR: #&&&&&&&&&&&&xtw.Formatting&=&Formatting.I<SPAN style="COLOR: #&&&&&&&&&&&&xtw.Indentation&=&<SPAN style="COLOR: #;<SPAN style="COLOR: #&&&&&&&&&&&&doc.WriteContentTo(xtw);<SPAN style="COLOR: #&&&&&&&&&&&&xtw.Flush();<SPAN style="COLOR: #&&&&&&&&&&&&xtw.Close();,注意我用的是VS2008开发的,所以呵呵!
阅读(...) 评论()C#关机小程序源码
字体:[ ] 类型:转载 时间:
这是用所学习的C#做的一个关机小程序,功能不多,只是为了练手,需要的朋友可以参考下
下面是运行的效果图核心代码: 代码如下: using S using System.Collections.G ponentM using System.D using System.D using System.L using System.T using System.Windows.F /* * * 整理:张晓天 * Q Q: * 日期: * */ namespace ExitComputer { public partial class Form1 : Form { int goTime = 0;//程序运行时间 string cmd =//写入shutdown的命令 int countTime = 0;//到程序执行的时间 public Form1() { InitializeComponent(); } /// &summary& /// 窗体加载事件 /// &/summary& /// &param name="sender"&&/param& /// &param name="e"&&/param& private void Form1_Load(object sender, EventArgs e) { nfiPic.Icon = this.I//指定系统的图标 label1.Text = DateTime.Now.ToString("yyyy年 MM月 dd日 HH :mm :ss");//系统时间 nudHour.Maximum = 23; nudMinutes.Maximum = 59; nudSecond.Maximum = 59;//指定控件的最大值 cboMonth.Text = DateTime.Now.Month.ToString(); cboDay.Text = DateTime.Now.Day.ToString(); nudHour.Value = DateTime.Now.H nudMinutes.Value = DateTime.Now.M nudSecond.Value = DateTime.Now.S//指定控件的值 //指定时间控件发生的频率 tmrTime.Interval = 1000; tmrTime.Enabled = //为月和日赋值 for (int i = 1; i & 13; i++) { cboMonth.Items.Add(i); } for (int i = 1; i & 32; i++) { cboDay.Items.Add(i); } //指定不可用的控件 cboMonth.Enabled = cboDay.Enabled = nudHour.Enabled = nudMinutes.Enabled = nudSecond.Enabled = btnExit.Enabled = } //定时的属性改写时事件 private void chkTiming_CheckedChanged(object sender, EventArgs e) { if (chkTiming.Checked == true) { cboMonth.Enabled = cboDay.Enabled = nudHour.Enabled = nudMinutes.Enabled = nudSecond.Enabled = } else { cboMonth.Enabled = cboDay.Enabled = nudHour.Enabled = nudMinutes.Enabled = nudSecond.Enabled = } } /// &summary& /// 显示窗体 /// &/summary& private void windowShow() { this.Show(); this.ShowInTaskbar = this.WindowState = FormWindowState.N } //重写事件实现气泡提示 protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); if (WindowState == FormWindowState.Minimized) { nfiPic.ShowBalloonTip(30); } } /// &summary& /// 隐藏托盘 /// &/summary& private void windowHide() { this.Hide(); this.ShowInTaskbar = nfiPic.Visible = nfiPic.ShowBalloonTip(30); } //最小化窗体时的事件 private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) this.windowHide(); } //鼠标双击托盘图标时的事件 private void nfiPic_MouseDoubleClick(object sender, MouseEventArgs e) { this.windowShow(); } //保证选择的月份是正确的 private void cboMonth_TextChanged(object sender, EventArgs e) { try { int temp1 = int.Parse(cboMonth.Text); int temp = int.Parse(cboDay.Text); if (temp1 & 1 || temp1 & 12) { cboMonth.Text = DateTime.Now.Month.ToString(); } if (cboMonth.Text == "2") { if (DateTime.IsLeapYear(DateTime.Now.Year) == true)//判断今年是否为闰年 { if (temp & 28) { cboDay.Text = DateTime.Now.Day.ToString(); } } else if (temp & 29) { cboDay.Text = DateTime.Now.Day.ToString(); } } else if (cboMonth.Text == "4" || cboMonth.Text == "6" || cboMonth.Text == "9" || cboMonth.Text == "11") { if (temp & 30) { cboDay.Text = DateTime.Now.Day.ToString(); } } } catch (Exception) { cboMonth.Text = DateTime.Now.Month.ToString(); } } //保证选择的天数是正确的 private void cboDay_TextChanged(object sender, EventArgs e) { try { int temp = int.Parse(cboDay.Text); if (temp & 1 || temp & 31) { cboDay.Text = DateTime.Now.Day.ToString(); } //判断月份 if (cboMonth.Text == "2") { if (DateTime.IsLeapYear(DateTime.Now.Year) == true)//判断今年是否为闰年 { if (temp & 28) { cboDay.Text = DateTime.Now.Day.ToString(); } } else if (temp & 29) { cboDay.Text = DateTime.Now.Day.ToString(); } } else if (cboMonth.Text == "4" || cboMonth.Text == "6" || cboMonth.Text == "9" || cboMonth.Text == "11") { if (temp & 30) { cboDay.Text = DateTime.Now.Day.ToString(); } } } catch (Exception) { cboDay.Text = DateTime.Now.Day.ToString(); } } //程序执行时给CountTime赋的值 private bool timeControl() { if (chkTiming.Checked == true) { DateTime startTime = Convert.ToDateTime(DateTime.Now.Year.ToString() + "/" + cboMonth.Text + "/" + cboDay.Text + " " + nudHour.Value.ToString() + ":" + nudMinutes.Value.ToString() + ":" + nudSecond.Value.ToString()); TimeSpan endtime = startTime - DateTime.N countTime = endtime.Days * 86400 + endtime.Hours * 3600 + endtime.Minutes * 60 + endtime.S } if (countTime & 0) { MessageBox.Show("对不起!您选择的时间有误!", "操作提示", MessageBoxButtons.OK, rmation); //让窗体回到初始化时的状态 chkTiming.Enabled = btnLogout.Enabled = btnOver.Enabled = btnAgain.Enabled = btnExit.Enabled = tmrTime.Enabled =
} tmrTime.Enabled =
} //时间控件每次发生的事件 private void tmrTime_Tick(object sender, EventArgs e) { label1.Text = DateTime.Now.ToString("yyyy年 MM月 dd日 HH :mm :ss"); if (cmd != null) { goTime += 1; if (countTime - goTime + 5 & 0) { txtRemind.Text = "0"; cmd = } else { //在提示文本中显示的内容 int temp = countTime - goTime + 1; txtRemind.Text = temp / 86400 + "天 " + temp % 86400 / 3600 + "时 " + temp % 3600 / 60 + "分 " + temp % 60 + "秒 "; if (countTime - goTime + 1 == 0) //判断时间是否到了 { System.Diagnostics.ProcessStartInfo p1 = new System.Diagnostics.ProcessStartInfo("shutdown.exe", cmd); p1.WindowStyle = System.Diagnostics.ProcessWindowStyle.H System.Diagnostics.Process.Start(p1); Application.ExitThread(); Application.Exit();//程序结束 } } } } /// &summary& /// 定时关机事件 /// &/summary& /// &param name="sender"&&/param& /// &param name="e"&&/param& private void btnOver_Click(object sender, EventArgs e) { if (!timeControl()) cmd = "-s -t 0"; lblRemind.Text = "剩余时间"; chkTiming.Checked = chkTiming.Enabled = btnExit.Enabled = Allow(); } /// &summary& /// 重启事件 /// &/summary& /// &param name="sender"&&/param& /// &param name="e"&&/param& private void btnAgain_Click(object sender, EventArgs e) { if (!timeControl()) cmd = "-r -t 0"; lblRemind.Text = "剩余时间"; chkTiming.Checked = chkTiming.Enabled = btnExit.Enabled = Allow(); } private void btnLogout_Click(object sender, EventArgs e) { if (!timeControl()) cmd = "-l"; lblRemind.Text = "剩余时间"; chkTiming.Checked = chkTiming.Enabled = btnExit.Enabled = Allow(); } private void tsmiShow_Click(object sender, EventArgs e) { this.windowShow(); } private void tsmiExit_Click(object sender, EventArgs e) { this.Dispose(); } /// &summary& /// 单击取消发生的事件 /// &/summary& /// &param name="sender"&&/param& /// &param name="e"&&/param& private void btnExit_Click(object sender, EventArgs e) { btnLogout.Enabled = btnOver.Enabled = btnAgain.Enabled = btnExit.Enabled = cmd = goTime = 0; countTime = 0; txtRemind.Text = "0"; lblRemind.Text = "关机提示"; chkTiming.Enabled = MessageBox.Show("任务已被成功取消", "操作提示", MessageBoxButtons.OK, rmation); } /// &summary& /// 提醒事件 /// &/summary& public void Allow() { DialogR result = MessageBox.Show("程序将自动最小化到托盘", "操作提示", MessageBoxButtons.YesNo, rmation); if (result == DialogResult.Yes) { this.windowHide(); } } } }
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具如何用C#写一个电脑关机程序? 就是点击关机按钮 就能让电脑关机_百度知道
如何用C#写一个电脑关机程序? 就是点击关机按钮 就能让电脑关机
你在窗体上添加一个按钮button1,在按钮的单击事件力添加代码即
System.Diagnostics.Process.Start(&cmd.exe&,&&#47;cshutdown -s -t 1000&); 这是一个定时关机代码,后面的1000表示倒计时1000秒后关机,如果要立即关机,把1000改为0就可以立即关机
其他类似问题
为您推荐:
using Microsoft.Win32;
using System.Runtime.InteropS
using System.T
namespace iSchoolWebBrowser
class EnvironmentCheckClass
[DllImport(&user32.dll&)]
static extern bool ExitWindowsEx(ExitWindows uFlags, ShutdownReason dwReason);
[DllImport(&kernel32.dll&, ExactSpelling = true)]
internal static extern IntPtr GetCurrentProcess();
[DllImport(&advapi32.dll&, ExactSpelling = true, SetLastError = true)]
internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
[DllImport(&advapi32.dll&, SetLastError = true)]
电脑关机的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁您所在的位置: &
C#编写自动关机程序复习的知识
C#编写自动关机程序复习的知识
刁钻的游戏
上面我每隔半秒进入中断一次,判断,如果已经设置过定时关机,就判断是否到达关机时间,并显示还剩多少秒关机。如果没有设置定时关机,就不显示。
498)this.width=498;' onmousewheel = 'javascript:return big(this)' width="372" height="160" src="/wyfs02/M02/72/D8/wKiom1XuduOioJLeAAAlUXBoY_E302.jpg" alt="" />
首先一个程序第一要素是logo
在设置里面可以设置程序图标,在ICON里设置。
ICON图标可以在网上下载。
这些都是表面功夫
程序中涉及到Buton、Label、Timer、Notiflcon控件
Button按钮控件,可以设计点击事件
如下所示:
private void button1_Click(object sender, EventArgs e)
&&&&&&&&&&&
&&&&&&&&&&&&if (Flag_True == 0)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&Flag_True = 1;
&&&&&&&&&&&&}
&&&&&&&&&&&&else
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&button1.Text = &确定&;
&&&&&&&&&&&&&&&&label6.Text = & &;
&&&&&&&&&&&&&&&&label7.Text = & &;
&&&&&&&&&&&&&&&&label5.Text = & &;
&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&Flag_True = 0;
&&&&&&&&&&&&}
&&&&&&&&&&&&shi = (int)numericUpDown3.V
&&&&&&&&&&&&fen = (int)numericUpDown2.V
&&&&&&&&&&&&miao = (int)numericUpDown1.V
&&&&&&&&&&&&time_set = shi * 3600 + fen * 60 +
&label控件操作简单
能够显示字符,并且其成员有text,可以随时更改文本
timer控件相当于嵌入式中的定时器,在属性中行为一栏中设置ENABLE&并且设置interval时间间隔500就是半秒。
private void timer1_Tick(object sender, EventArgs e)
&&&&&&&&&&&&Int32 time_
&&&&&&&&&&&&Int32
&&&&&&&&&&&&if (Flag_True == 1)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&if (DateTime.Now.Minute == fen && DateTime.Now.Hour == shi && DateTime.Now.Second == miao)
&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&button1.Text = &取消&;
&&&&&&&&&&&&&&&&&&&&label6.Text = &剩余关机时间&;
&&&&&&&&&&&&&&&&&&&&label7.Text = &秒&;
&&&&&&&&&&&&&&&&&&&&label5.Text = &0&;
&&&&&&&&&&&&&&&&&&&&System.Diagnostics.Process.Start(&shutdown&,&-s -t 0&);
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&else
&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&time_now = DateTime.Now.Second + DateTime.Now.Minute * 60 + DateTime.Now.Hour * 3600;
&&&&&&&&&&&&&&&&&&&&extra = time_set - time_
&&&&&&&&&&&&&&&&&&&&if (extra & 0)
&&&&&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&&&&&button1.Text = &取消&;
&&&&&&&&&&&&&&&&&&&&&&&&label6.Text = &剩余关机时间&;
&&&&&&&&&&&&&&&&&&&&&&&&label7.Text = &秒&;
&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&label5.Text = extra.ToString();
&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&&&&&else
&&&&&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&&&&&Flag_True = 0;
&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
上面我每隔半秒进入中断一次,判断,如果已经设置过定时关机,就判断是否到达关机时间,并显示还剩多少秒关机。如果没有设置定时关机,就不显示。
其中button1和Label的text都可以随时更改。
基本功能设置完成
接下来还有一个最小化到托盘的设置
用到Notiflcon控件
此控件设置最小化图标,在设置里可以设置icon图标。
他带有的事件有鼠标单击,鼠标双击,单击,双击。
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
&&&&&&&&&&&&this.Visible = true;
&&&&&&&&&&&&this.WindowState = FormWindowState.N
&&&&&&&&&&&&this.notifyIcon1.Visible = false;
上述我设置了鼠标单击,代码里是恢复可视化,正常窗口。
再之得设置程序最小化时隐藏在下边
private void Form1_SizeChanged(object sender, EventArgs e)
&&&&&&&&&&&&if (this.WindowState == FormWindowState.Minimized)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&this.Hide();
&&&&&&&&&&&&&&&&this.notifyIcon1.Visible = true;
&&&&&&&&&&&&}
上述就是一个关机程序,自己做着玩的。。
整体构架如下图所示。
namespace 关机任务管理V1._0
&&&&public partial class Form1 : Form
&&&&&&&&int shi, fen,
&&&&&&&&Int32 time_
&&&&&&&&int Flag_True = 0;
&&&&&&&&public Form1()
&&&&&&&&&&&&&
&&&&&&&&&&&&InitializeComponent();
&&&&&&&&private void Form1_Load(object sender, EventArgs e)
&&&&&&&&&&&&&
&&&&&&&&private void numericUpDown1_ValueChanged(object sender, EventArgs e)
&&&&&&&&&&&&if (numericUpDown1.Value == -1)
&&&&&&&&&&&&&&&&numericUpDown1.Value = 60;
&&&&&&&&&&&&else if (numericUpDown1.Value == 61)
&&&&&&&&&&&&&&&&numericUpDown1.Value = 0;
&&&&&&&&private void numericUpDown2_ValueChanged(object sender, EventArgs e)
&&&&&&&&&&&&if (numericUpDown2.Value == -1)
&&&&&&&&&&&&&&&&numericUpDown2.Value = 60;
&&&&&&&&&&&&else if (numericUpDown2.Value == 61)
&&&&&&&&&&&&&&&&numericUpDown2.Value = 0;
&&&&&&&&private void numericUpDown3_ValueChanged(object sender, EventArgs e)
&&&&&&&&&&&&if (numericUpDown3.Value == 25)
&&&&&&&&&&&&&&&&numericUpDown3.Value = 0;
&&&&&&&&&&&&else if (numericUpDown3.Value == -1)
&&&&&&&&&&&&&&&&numericUpDown3.Value = 24;
&&&&&&&&private void button1_Click(object sender, EventArgs e)
&&&&&&&&&&&
&&&&&&&&&&&&if (Flag_True == 0)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&Flag_True = 1;
&&&&&&&&&&&&}
&&&&&&&&&&&&else
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&button1.Text = &确定&;
&&&&&&&&&&&&&&&&label6.Text = & &;
&&&&&&&&&&&&&&&&label7.Text = & &;
&&&&&&&&&&&&&&&&label5.Text = & &;
&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&Flag_True = 0;
&&&&&&&&&&&&}
&&&&&&&&&&&&shi = (int)numericUpDown3.V
&&&&&&&&&&&&fen = (int)numericUpDown2.V
&&&&&&&&&&&&miao = (int)numericUpDown1.V
&&&&&&&&&&&&time_set = shi * 3600 + fen * 60 +
&&&&&&&&private void timer1_Tick(object sender, EventArgs e)
&&&&&&&&&&&&Int32 time_
&&&&&&&&&&&&Int32
&&&&&&&&&&&&if (Flag_True == 1)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&if (DateTime.Now.Minute == fen && DateTime.Now.Hour == shi && DateTime.Now.Second == miao)
&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&button1.Text = &取消&;
&&&&&&&&&&&&&&&&&&&&label6.Text = &剩余关机时间&;
&&&&&&&&&&&&&&&&&&&&label7.Text = &秒&;
&&&&&&&&&&&&&&&&&&&&label5.Text = &0&;
&&&&&&&&&&&&&&&&&&&&System.Diagnostics.Process.Start(&shutdown&,&-s -t 0&);
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&else
&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&time_now = DateTime.Now.Second + DateTime.Now.Minute * 60 + DateTime.Now.Hour * 3600;
&&&&&&&&&&&&&&&&&&&&extra = time_set - time_
&&&&&&&&&&&&&&&&&&&&if (extra & 0)
&&&&&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&&&&&button1.Text = &取消&;
&&&&&&&&&&&&&&&&&&&&&&&&label6.Text = &剩余关机时间&;
&&&&&&&&&&&&&&&&&&&&&&&&label7.Text = &秒&;
&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&label5.Text = extra.ToString();
&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&&&&&else
&&&&&&&&&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&&&&&&&&&Flag_True = 0;
&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
&&&&&&&&private void label5_Click(object sender, EventArgs e)
&&&&&&&&private void label4_Click(object sender, EventArgs e)
&&&&&&&&private void label3_Click(object sender, EventArgs e)
&&&&&&&&private void label6_Click(object sender, EventArgs e)
&&&&&&&&private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
&&&&&&&&&&&&this.Visible = true;
&&&&&&&&&&&&this.WindowState = FormWindowState.N
&&&&&&&&&&&&this.notifyIcon1.Visible = false;
&&&&&&&&private void Form1_SizeChanged(object sender, EventArgs e)
&&&&&&&&&&&&if (this.WindowState == FormWindowState.Minimized)
&&&&&&&&&&&&{
&&&&&&&&&&&&&&&&this.Hide();
&&&&&&&&&&&&&&&&this.notifyIcon1.Visible = true;
&&&&&&&&&&&&}
界面如下:
498)this.width=498;' onmousewheel = 'javascript:return big(this)' src="/wyfs02/M00/72/D5/wKioL1XueQ3Cw8FGAAAlUXBoY_E869.jpg" alt="" />
&【编辑推荐】【责任编辑: TEL:(010)】
关于&&&&的更多文章
新手程序员你们好!你是否做好了进入编程世界的准备呢?要知道,
所以姑娘,让我们做一枚花见花开的程序媛。
讲师: 19人学习过讲师: 14人学习过讲师: 811人学习过
2014年节假放假安于这周出台,80%的公民对此次的放假
进入12月份,一年的日子到头了。年末总结什么的也都开
Jquery是继prototype之后又一个优秀的Javascript框架
《程序员密码学》涉及密码学的各个研究方向,分组密码、散列函数、公钥密码以及相关的攻击,同时也讲解了密码学算法实现上常用的
51CTO旗下网站

我要回帖

更多关于 c语言编写定时关机 的文章

 

随机推荐