program shutdown otomatis dengan vb.net

‘ ////// berikut ini ada source code program untuk ngebuat windows dapat shutdown secara otomatis
‘ ////// karena saia males menerangkan satu persatu code program ini.jadi anda cukup copy pastekan saja
‘ ////// source code ini dan jangan lupa di compile.

Public Class Shutdown

Inherits System.Windows.Forms.Form
Private pilihan As Integer

#Region ” Windows Form Designer generated code ”
#End Region
Dim myProcesses() As Process
Dim myProcess As Process
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
pilihan = 1
tVreme.Enabled = True
pgProcenat.Value = 0
pgProcenat.Maximum = 60 * 60 * sat.Value + 60 * minut.Value + sekund.Value
paOdustani.Visible = True
pgProcenat.Visible = True
sekund.Enabled = False
minut.Enabled = False
sat.Enabled = False
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tVreme.Tick
If (sekund.Value = 0) And (minut.Value = 0) And (sat.Value = 0) Then
If pilihan = 2 Then
Shell(“tsshutdn 0 /powerdown /delay:0”)
tVreme.Enabled = False
Exit Sub
End If
If pilihan = 3 Then
Shell(“tsshutdn 0 /reboot /delay:0”)
tVreme.Enabled = False
Exit Sub
End If
If pilihan = 1 Then
Shell(“shutdown -l”)
tVreme.Enabled = False
Exit Sub
End If
‘tsdiscon.exe
If pilihan = 4 Then
‘tVreme.Enabled = False
Shell(“tsdiscon”)
tVreme.Enabled = False
Exit Sub
End If
End If

If sekund.Value = 0 Then
If minut.Value = 0 Then
sat.Value = sat.Value – 1
minut.Value = 59
Else
minut.Value = minut.Value – 1

End If
sekund.Value = 59
Else
sekund.Value = sekund.Value – 1
End If

pgProcenat.Value = pgProcenat.Value + 1

End Sub

Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
pilihan = 2
tVreme.Enabled = True
pgProcenat.Value = 0
pgProcenat.Maximum = 60 * 60 * sat.Value + 60 * minut.Value + sekund.Value
paOdustani.Visible = True
pgProcenat.Visible = True
sekund.Enabled = False
minut.Enabled = False
sat.Enabled = False
End Sub

Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
pilihan = 3
tVreme.Enabled = True
pgProcenat.Value = 0
pgProcenat.Maximum = 60 * 60 * sat.Value + 60 * minut.Value + sekund.Value
paOdustani.Visible = True
pgProcenat.Visible = True
sekund.Enabled = False
minut.Enabled = False
sat.Enabled = False
End Sub

Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click
sekund.Enabled = True
minut.Enabled = True
sat.Enabled = True

tVreme.Enabled = False
sat.Value = 0
minut.Value = 0
sekund.Value = 0
pgProcenat.Value = 0
paOdustani.Visible = False
pgProcenat.Visible = False
End Sub

Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
pilihan = 4
tVreme.Enabled = True
pgProcenat.Value = 0
pgProcenat.Maximum = 60 * 60 * sat.Value + 60 * minut.Value + sekund.Value
paOdustani.Visible = True
pgProcenat.Visible = True
sekund.Enabled = False
minut.Enabled = False
sat.Enabled = False
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
‘Dim myProcesses() As Process
‘Dim myProcess As Process
MessageBox.Show(“hati2 OS akan shutdown”,”peringatan”, MessageBoxButtons.OK, MessageBoxIcon.Warning)

Try
‘ Returns array containing all instances of “Notepad”.
myProcesses = Process.GetProcessesByName(lbProcesi.SelectedItem.ToString)
For Each myProcess In myProcesses
myProcess.Kill()
Next
Catch ex As Exception
MessageBox.Show(“Ovo je sistemski proces i nemoguce ga je prekinuti !”, “Upozorenje”, MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try
End Sub

Private Sub tmSat_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmSat.Tick
lbProcesi.Items.Clear()
‘Dim myProcesses() As Process
‘Dim myProcess As Process
myProcesses = Process.GetProcesses
‘ Iterate through the process array.
For Each myProcess In myProcesses
lbProcesi.Items.Add(myProcess.ProcessName.ToString)
Next
End Sub

Private Sub shutdown_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lbProcesi.Items.Clear()
‘Dim myProcesses() As Process
‘Dim myProcess As Process
myProcesses = Process.GetProcesses
‘ Iterate through the process array.
For Each myProcess In myProcesses
lbProcesi.Items.Add(myProcess.ProcessName.ToString)
Next
‘Me.Hide()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
‘Application.Exit()
Me.Visible = False
End Sub

Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
mi100.Checked = True
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
mi100.Checked = False
Me.Visible = False
MenuItem1.Enabled = True
MenuItem2.Enabled = False
End Sub

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
Application.Exit()
End Sub

Private Sub mi10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi10.Click
Me.Opacity = 0.1
mi10.Checked = Not mi10.Checked
mi1.Checked = False
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi30.Click
Me.Opacity = 0.3
mi30.Checked = Not mi30.Checked
mi1.Checked = False
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi10.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi50_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi50.Click
Me.Opacity = 0.5
mi50.Checked = Not mi50.Checked
mi1.Checked = False
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi30.Checked = False
mi10.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi70_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi70.Click
Me.Opacity = 0.7
mi70.Checked = Not mi70.Checked
mi1.Checked = False
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi30.Checked = False
mi50.Checked = False
mi10.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi90_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi90.Click
Me.Opacity = 0.9
mi90.Checked = Not mi90.Checked
mi1.Checked = False
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi10.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi100_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi100.Click, Sysni.Click
Me.Opacity = 1
mi100.Checked = True ‘Not mi100.Checked
mi1.Checked = False
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi10.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi1.Click
Me.Opacity = 0.01
mi1.Checked = Not mi1.Checked
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi10.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi3.Click
Me.Opacity = 0.03
mi3.Checked = Not mi3.Checked
mi1.Checked = False
mi5.Checked = False
mi7.Checked = False
mi9.Checked = False
mi10.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi5.Click
Me.Opacity = 0.05
mi5.Checked = Not mi5.Checked
mi3.Checked = False
mi1.Checked = False
mi7.Checked = False
mi9.Checked = False
mi10.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi7.Click
Me.Opacity = 0.07
mi7.Checked = Not mi7.Checked
mi3.Checked = False
mi5.Checked = False
mi1.Checked = False
mi9.Checked = False
mi10.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub

Private Sub mi9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mi9.Click
Me.Opacity = 0.09
mi9.Checked = Not mi9.Checked
mi3.Checked = False
mi5.Checked = False
mi7.Checked = False
mi1.Checked = False
mi10.Checked = False
mi30.Checked = False
mi50.Checked = False
mi70.Checked = False
mi90.Checked = False
mi100.Checked = False
Me.Visible = True
MenuItem1.Enabled = False
MenuItem2.Enabled = True
End Sub
Private Sub Sysni_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Sysni.Click
‘Me.Visible = True
‘Me.Opacity = 1
End Sub
End Class

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: