[原创]我做的一个定时关机器,请指教
代码:
Private Sub Command1_Click()
If MsgBox("确实要注消吗?", 48 + vbYesNo, "警告") = vbYes Then
Label1.Caption = "正在注消......"
Timer1.Enabled = False
Shell "shutdown /l"
End If
End Sub
Private Sub Command2_Click()
If MsgBox("确实要关机吗?", 48 + vbYesNo, "警告") = vbYes Then
Label1.Caption = "正在关机......"
Timer1.Enabled = False
Shell "shutdown /f /s /t 0"
End If
End Sub
Private Sub Command3_Click()
Command3.Visible = False
Text1.Visible = False
If MsgBox("确实要定在" + Text1.Text + "关机吗?", vbQuestion + vbYesNo, "定时关机") = vbYes Then
Text1.Text = Text1.Text + ":00"
Form1.Hide
End If
Timer2.Enabled = True
End Sub
Private Sub Label1_Click()
Text1.Visible = True
Command3.Visible = True
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Date + Time()
End Sub
Private Sub Timer2_Timer()
If Time() = Text1.Text Then
Shell "shutdown /f /s /t 0"
End If
End Sub