Wednesday 20 February 2008

shutdown timer {vb.6}

Sebenarnya script ini sudah banyak tersebar dimana-mana, baik buku ataupun di forum. Bagi saudara yang belum sempat menemukannya, ini code untuk membuat komputer shutdown. Dengan sedikit sentuhan componen timer anda sudah bisa membuat aplikasi shutdown timer sendiri. Semoga bisa menjadi sumber inspirasi untuk project selanjutnya.

Sebelumnya anda cukup menyediakan 1 textbox, 1 command dan 1 timer pada form anda lalu copy paste code berikut. Selamat mencoba

'code textbox
Private Sub Text1_KeyPress(KeyAscii As Integer)
On Error GoTo pesan

If KeyAscii = 13 Then

If Text1.Text = "0" Or Text1.Text < interval =" 60000" enabled =" False">


'code timer
Private Sub Timer1_Timer()
If Text1.Text = 0 Then
Shell ("shutdown -s -f -t 0")
Else
Text1.Text = Text1.Text - 1
End If
End Sub
'code command
Private Sub Command1_Click()
Timer1.Interval = 0
Text1.Enabled = True
Text1.Text = "min"
End Sub

No comments:

Recent Comments Blog