Rabu, 25 Mei 2011

Membuat Kompuer Otomatis Shutdown

-->
Memerintahkan Komputer Untuk Shutdown
Shell ("shutdown -s -f -t 0")   
Memerintahkan Komputer untuk  Log Off
Shell ("shotdown -l -f -t 0")
Memerintahkan Kompuer Untuk Restat
Shell ("shotdown -r -f -t 0")
Contoh aplikasi Shutdown Otomatis




--> -->
Form Shutdown
Private Sub Timer1_Timer()
ProgressBar1.Value = ProgressBar1.Value + 1
LbPersen.Caption = ProgressBar1.Value

If ProgressBar1.Value = 100 Then
Shell ("shutdown -s -f -t 0")
Timer1.Interval = 0
End
End If
End Sub


Option Explicit
Private Sub DTPicker1_Change()
LValueTime.Caption = DTPicker1.Value
End Sub


Private Sub Form_Load()
Me.Left = Screen.Width - (Me.Width + 100)
Me.Top = Screen.Height
Timer1.Interval = 1
End Sub


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Label3.ForeColor = &H0&
Label2.ForeColor = &H0&
End Sub


Private Sub GbLogOff_Click()
LbStatus.Caption = "Auto Log OFF ON"
End Sub


Private Sub GbNormal_Click()
LbStatus.Caption = "SYSTEM NORMAL"
End Sub


Private Sub GbShotdown_Click()
LbStatus.Caption = "Auto Shutdown ON"
'FrmShotdown.Show
End Sub


Private Sub Label2_Click()
If ControlTime.BackColor = &HFF00& Then
LbInfo.Caption = "Shutdown by time seting"
ControlTime.BackColor = &HFF&
ControlPlayer.BackColor = &HFF00&
Else
LbInfo.Caption = "No seting Cheng"
ControlTime.BackColor = &HFF00&
End If
End Sub


Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Label2.ForeColor = &HFF00&
End Sub



Private Sub Label3_Click()
If ControlPlayer.BackColor = &HFF00& Then
LbInfo.Caption = "Shutdown after All  Playlist Played"
ControlPlayer.BackColor = &HFF&
ControlTime.BackColor = &HFF00&
Else
LbInfo.Caption = "No seting Cheng"
ControlPlayer.BackColor = &HFF00&
End If
End Sub


Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Label3.ForeColor = &HFF00&
End Sub


Private Sub Timer1_Timer()
If Me.Top <= 1 Then
'Timer1.Enabled = False
Timer1.Interval = 0
Else
Me.Top = Me.Top - 100
End If
End Sub


Private Sub Timer2_Timer()
If LbStatus.Left < PicMonitor.Width - PicMonitor.Width - LbStatus.Width Then
    LbStatus.Left = PicMonitor.Width - 1
    LbStatus.Left = LbStatus.Left - 5
Else
   LbStatus.Left = LbStatus.Left - 10
End If
End Sub



Private Sub TimerJam_Timer()
LbTime.Caption = Time
If LbTime.Caption = LValueTime.Caption And ControlTime.BackColor = &HFF& Then
FrmShotdown.Show
End If
End Sub


Sub MatikanKom()
'Pengaturan log off komputer
If LbStatus.Caption = "Auto Log OFF ON" And ControlPlayer.BackColor = &HFF& Then
Shell ("shotdown -l -f -t 0")
End If
'pengaturan shotdown komputer
If LbStatus.Caption = "Auto Shutdown ON" And ControlPlayer.BackColor = &HFF& Then
FrmShotdown.Show
End If
End Sub


Download Project nya di sini : Auto Shutdown.zip

Tidak ada komentar:

Posting Komentar