Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion WinNUT_V2/WinNUT_GUI/Shutdown_Gui.vb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ Public Class Shutdown_Gui
System.Threading.Thread.Sleep(1000)
WinNUT.Shutdown_Action()
Run_Timer.Enabled = False
Me.Shutdown_Timer.Stop()
Me.Shutdown_Timer.Enabled = False
Me.Grace_Timer.Stop()
Me.Grace_Timer.Enabled = False
Me.Hide()
Me.Close()
End Sub

Private Sub Run_Timer_Tick(sender As Object, e As EventArgs) Handles Run_Timer.Tick
Expand Down Expand Up @@ -137,4 +143,4 @@ Public Class Shutdown_Gui
e.Cancel = True
End If
End Sub
End Class
End Class
6 changes: 3 additions & 3 deletions WinNUT_V2/WinNUT_GUI/WinNUT.vb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Public Class WinNUT
Private Event On_Line()
Private Event UpdateNotifyIconStr(ByVal Reason As String, ByVal Message As String)
Private Event UpdateBatteryState(ByVal Reason As String)
Declare Function SetSystemPowerState Lib "kernel32" (ByVal fSuspend As Integer, ByVal fForce As Integer) As Integer
Declare Function SetSuspendState Lib "PowrProf" (ByVal Hibernate As Integer, ByVal ForceCritical As Integer, ByVal DisableWakeEvent As Integer) As Integer

Public Property UpdateMethod() As String
Get
Expand Down Expand Up @@ -980,9 +980,9 @@ Public Class WinNUT
Case 0
Process.Start("C:\WINDOWS\system32\Shutdown.exe", "-f -s -t 0")
Case 1
SetSystemPowerState(True, 0)
SetSuspendState(False, False, True) 'Suspend
Case 2
SetSystemPowerState(False, 0)
SetSuspendState(True, False, True) 'Hibernate
End Select
End Sub

Expand Down