定时关机VB小程序 含源码窗体

时间:2015-05-09 12:54:05
【文件属性】:
文件名称:定时关机VB小程序 含源码窗体
文件大小:59KB
文件格式:RAR
更新时间:2015-05-09 12:54:05
定时关机,VB 可以设置定时关机,一段时间后关机 Private Sub Command1_Click() h = Combo1.Text s = Combo2.Text If (h >= 0 And h <= 23 And s >= 0 And s <= 59) Then Text1.Text = Combo1.Text + ":" + Combo2.Text Form2.Hide Else: MsgBox "你输入的数据格式不正确,是否继续?", vbOKOnly, "错误提示" End If Shell "cmd /c at text1.Text shutdown -s -t 5" End Sub Private Sub Command2_Click() Dim Savetime As Double Savetime = timeGetTime '记下开始时的时间 Form2.Hide While timeGetTime < Savetime + 3600000 '循环等待 DoEvents '转让控制权,以便让操作系统处理其它的事件 Wend Shell "cmd /c shutdown -s -t 5" Form2.Show End Sub Private Sub Command3_Click() Dim Savetime As Double Savetime = timeGetTime '记下开始时的时间 Form2.Hide While timeGetTime < Savetime + 7200000 '循环等待 DoEvents '转让控制权,以便让操作系统处理其它的事件 Wend Shell "cmd /c shutdown -s -t 5" Form2.Show End Sub Private Sub Command4_Click() Dim Savetime As Double Savetime = timeGetTime '记下开始时的时间 Form2.Hide While timeGetTime < Savetime + 18000000 '循环等待 DoEvents '转让控制权,以便让操作系统处理其它的事件 Wend Shell "cmd /c shutdown -s -t 5" Form2.Show End Sub Private Sub Command5_Click() s = InputBox("请换算成秒(1小时=3600秒,1分钟=60秒)", "多久后关机?") Dim Savetime As Double Savetime = timeGetTime '记下开始时的时间 Form2.Hide While timeGetTime < Savetime + s * 1000 '循环等待 DoEvents '转让控制权,以便让操作系统处理其它的事件 Wend Shell "cmd /c shutdown -s -t 5" Form2.Show End Sub Private Sub Command6_Click() End End Sub Private Sub Command7_Click() Shell "cmd /c shutdown -a" End Sub Private Sub Timer1_Timer() Label2.Caption = Format(Time, "h:mm") If (Text1.Text = Label2.Caption) Then Shell "cmd /c shutdown -s -t 5" Timer1.Enabled = False Form2.Show End If End Sub
【文件预览】:
frmAbout.frm
定时关机系统1.2.exe
Form1.frm
工程1.vbp
Form1.frx
frmAbout.frx
ceshi.exe
Form2.frx
Form2.frm
工程1.vbw

网友评论

  • 还不错,不过还是不太会用