Tjo kollade igenom min dator och råkade hitta ett par gamla projekt! Hade det inte varit enklare att använda den inbyggda shutdown kommandot, typ shutdown -s -t [tid i sekunder till avstängning] Kanske är enklare. men roligare att göra egna prog :) Jag skrattar när jag läser allt detta Bullshit.Shut down timer
1,a en timer som agerar efter sec! = va bland det första jag gjorde!
2,a en timer som agerar efter min! = Uppföljaren, dock onödigt mkt kod!
3,e 90% klar, dock avstannat projekt, men kmr sen när jag få för mig att göra klar den :)
1,a -----------------------------------------
3, buttons
2, comboboxes
1, textbox
10, timers
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
TextBox1.Text = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text += 1
If TextBox1.Text = ComboBox1.Text Then
Shell("shutdown -s")
Timer1.Stop()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
MsgBox("10/s!" & vbCrLf & "100/s!" & vbCrLf & "1800/s = 1/2H!" & vbCrLf & "3600/s = 1H!" & vbCrLf & "5400/s = 1.1/2H!" & vbCrLf & "7200/s = 2H!", MsgBoxStyle.Information, "Made by miz™")
End Sub
End Class
---------------------------------------------
2,a-----------------------------------------
'3: buttons = Glassbuttons fräsh efekt :) se här = http://pellesoft.se/communicate/forum/view.aspx?msgid=288908&forumid=2&sum=1
'1: timer
'1: combobox
'1: textbox
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text += 1
If TextBox1.Text = 30 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer1.Stop()
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
TextBox1.Text += 1
If TextBox1.Text = 60 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer2.Stop()
End If
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
TextBox1.Text += 1
If TextBox1.Text = 90 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer3.Stop()
End If
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
TextBox1.Text += 1
If TextBox1.Text = 120 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer4.Stop()
End If
End Sub
Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
TextBox1.Text += 1
If TextBox1.Text = 150 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer5.Stop()
End If
End Sub
Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
TextBox1.Text += 1
If TextBox1.Text = 180 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer6.Stop()
End If
End Sub
Private Sub Timer7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer7.Tick
TextBox1.Text += 1
If TextBox1.Text = 210 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer7.Stop()
End If
End Sub
Private Sub Timer8_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer8.Tick
TextBox1.Text += 1
If TextBox1.Text = 240 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer8.Stop()
End If
End Sub
Private Sub Timer9_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer9.Tick
TextBox1.Text += 1
If TextBox1.Text = 270 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer9.Stop()
End If
End Sub
Private Sub Timer10_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer10.Tick
TextBox1.Text += 1
If TextBox1.Text = 300 Then
ComboBox1.Text = "Shutdown"
Shell("shutdown -s")
ElseIf ComboBox1.Text = "Loggoff" Then
Shell("shutdown -l")
ElseIf ComboBox1.Text = "Restart" Then
Shell("shutdown -r")
Timer10.Stop()
End If
End Sub
Private Sub GlassButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GlassButton1.Click
If ComboBox2.Text = "30min" Then
Timer1.Start()
ElseIf ComboBox2.Text = "1.hour" Then
Timer2.Start()
ElseIf ComboBox2.Text = "1.1/5hour" Then
Timer3.Start()
ElseIf ComboBox2.Text = "2.hour" Then
Timer4.Start()
ElseIf ComboBox2.Text = "2.1/5hour" Then
Timer5.Start()
ElseIf ComboBox2.Text = "3.hour" Then
Timer6.Start()
ElseIf ComboBox2.Text = "3.1/5hour" Then
Timer7.Start()
ElseIf ComboBox2.Text = "4.hour" Then
Timer8.Start()
ElseIf ComboBox2.Text = "4.1/5hour" Then
Timer9.Start()
ElseIf ComboBox2.Text = "5.hour" Then
Timer10.Start()
End If
End Sub
Private Sub GlassButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GlassButton3.Click
MsgBox("1:Chose option" & vbCrLf & "Shutdown / Restart / Loggoff" & vbCrLf & "2:Select time" & vbCrLf & "Then press start" & vbCrLf & "Stop/Reset stop al timers!", MsgBoxStyle.Information, "Made by miz™")
End Sub
Private Sub GlassButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GlassButton2.Click
Timer1.Stop()
Timer2.Stop()
Timer3.Stop()
Timer4.Stop()
Timer5.Stop()
Timer6.Stop()
Timer7.Stop()
Timer8.Stop()
Timer9.Stop()
Timer10.Stop()
TextBox1.Text = 0
Shell("shutdown -a")
End Sub
End Class
---------------------------------------------
Anledning till detta projekt = somna till film är bland det bästa :)Sv: Shut down timer
Eller varför inte det eminenta psshutdown från gamla goa sysinternals där man, hör och häpna, kan ange klockslag när avlust/omstart ska ske: http://technet.microsoft.com/en-us/sysinternals/bb897541Sv:Shut down timer
klockslag när avlust/omstart är också en möjlighet,
har den funktionen i den senaste timern jag programerat, dock är den inte klar
då jag tröttnade på det, men kmr väl nån dag de med :)
Kände bara för att lägga till nått i forumet! Sv: Shut down timer
Allt du skrivet kan man göra med en Timer.
Sen kör man Select Case på alla varinter.
Uhhhhhhhhh för trånghuvud.