这是源代码.我按下关机按扭后.到了关机时间后..仍然不能实现关机..大家帮帮忙哈!
Dim Reboot As Integer //定义是否按下了关机按扭
Dim h, m, s As Integer //保存当前系统时间的 小时,分,秒
Private Sub CmdQuit_Click() //按下 退出
End
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 23 //将小时添加到ComboBox控件里.
CobHour.AddItem i
Next i
For i = 0 To 59 //将分钟添加到ComboBox控件里.
CobMinute.AddItem i
Next i
For i = 0 To 59 //将秒添加到ComboBox控件里.
CobSecond.AddItem i
Next i
Timer1.Interval = 800 //定时器
h = hour(Time())
m = minute(Time())
s = second(Time())
End Sub
Private Sub Timer1_Timer() //自动检测是否达到了关机条件.如果满足就关机.
LblTime.Caption = Time()
If (Reboot = 1 And Int(Val(CobHour.Text)) = h And Int(Val(CobMinute.Text)) = m And Int(Val(CobSecond.Text)) = s) Then
c = Shell("c:\windows\system32\shutdown.exe /s", 30)
End If
End Sub
Private Sub CmdStart_Click() //按下了关机按扭
Reboot = 1
a = MsgBox("您已经点下了开始按扭,现在开始进入关机倒计时", , "警告")
End Sub