From 82cdfe6a2ccfeee8f09d469b7f9dd91fa3fa048a Mon Sep 17 00:00:00 2001 From: g-cranston <95360513+g-cranston@users.noreply.github.com> Date: Tue, 15 Feb 2022 23:54:39 +0000 Subject: [PATCH 1/2] Update WinNUT.vb --- WinNUT_V2/WinNUT_GUI/WinNUT.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WinNUT_V2/WinNUT_GUI/WinNUT.vb b/WinNUT_V2/WinNUT_GUI/WinNUT.vb index a1b5264..00c5380 100644 --- a/WinNUT_V2/WinNUT_GUI/WinNUT.vb +++ b/WinNUT_V2/WinNUT_GUI/WinNUT.vb @@ -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 @@ -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 From 0db12195162755f657e4f453604e78b1f2daa6ba Mon Sep 17 00:00:00 2001 From: g-cranston <95360513+g-cranston@users.noreply.github.com> Date: Wed, 16 Feb 2022 00:02:03 +0000 Subject: [PATCH 2/2] Update Shutdown_Gui.vb --- WinNUT_V2/WinNUT_GUI/Shutdown_Gui.vb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/WinNUT_V2/WinNUT_GUI/Shutdown_Gui.vb b/WinNUT_V2/WinNUT_GUI/Shutdown_Gui.vb index 192c33f..8a5bf6c 100644 --- a/WinNUT_V2/WinNUT_GUI/Shutdown_Gui.vb +++ b/WinNUT_V2/WinNUT_GUI/Shutdown_Gui.vb @@ -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 @@ -137,4 +143,4 @@ Public Class Shutdown_Gui e.Cancel = True End If End Sub -End Class \ No newline at end of file +End Class