[ bolepks @ 06.11.2012. 11:20 ] @
Napravio sam timer za gašenje PC sve funkcioniše, osim kada kliknem i treba da se ugase on potpuno ne ugasi računar već se čuju ventilatori, u čemu je problem?
Evo koda

Public Class Form1


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = Format(TimeOfDay)
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer2.Enabled = True
TextBox1.Enabled = False
Button2.Enabled = True
Button1.Enabled = False

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer2.Enabled = False
TextBox1.Text = "00:00:00"
TextBox1.Enabled = True
Button1.Enabled = True
Button2.Enabled = False
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If TextBox1.Text = Label1.Text Then
Shell("shutdown -s")
End If

End Sub
End Class
[ FOX028 @ 06.11.2012. 11:30 ] @
evo pogledaj na ovom linku imas nesto o proceduri za gasenje PC-a

http://www.vbforfree.com/218/how-to-easily-shutdown-restart-and-log-off-the-computer-without-apis/
[ shpiki @ 06.11.2012. 20:27 ] @
Code:
Declare Function ExitWindowsEx Lib "user32" Alias "ExitWindowsEx" (byval uFlags as Long, byval dwReserved as Long) as Long

public Const EWX_FORCE = 4
public Const EWX_LOGOFF = 0
public Const EWX_SHUTDOWN = 1
public Const EWX_REBOOT = 2