Rabu, 27 Maret 2013

Software Shutdown Otomatis

Berikut ini adalah sebuah software kecil untuk menset kapan kita ingin komputer kita shutdown. Semoga bermanfaat.

Dim pukul As Timer

Private Sub cmdSET_Click()
'Call Shell("Shutdown /s") 'to shutdown
'Call Shell("Shutdwon /r") 'to restart
'Call Shell("Shutdown /l") 'to logoff
'Call Shell("Shutdown /a") 'to Abort

Dim Jam, Menit As String
Jam = IIf(CInt(txtJam.Text < 10), "0" & txtJam.Text, txtJam.Text)
Menit = IIf(CInt(txtMenit.Text) < 10, "0" & txtMenit.Text, txtMenit.Text)

lblPukul.Caption = Jam & Label2.Caption & Menit & ":00"
Timer1.Enabled = True

End Sub

Private Sub cmdTutup_Click()
    End
End Sub

Private Sub Timer1_Timer()
lblTime.Caption = Time
If lblTime.Caption = lblPukul.Caption Then
    Call Shell("Shutdown /s") 'to shutdown
End If
End Sub

Private Sub txtJam_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    txtMenit.SetFocus
Else
    If Not IsNumeric(Chr(KeyAscii)) Then
        MsgBox "Inputan harus numeric"
    End If
End If
End Sub

Private Sub txtMenit_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) Then
    MsgBox "Inputan harus numeric"
End If
End Sub