File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ Public Class Shutdown_Gui
102102 System.Threading.Thread.Sleep( 1000 )
103103 WinNUT.Shutdown_Action()
104104 Run_Timer.Enabled = False
105+ Me .Shutdown_Timer.Stop()
106+ Me .Shutdown_Timer.Enabled = False
107+ Me .Grace_Timer.Stop()
108+ Me .Grace_Timer.Enabled = False
109+ Me .Hide()
110+ Me .Close()
105111 End Sub
106112
107113 Private Sub Run_Timer_Tick(sender As Object , e As EventArgs) Handles Run_Timer.Tick
Original file line number Diff line number Diff line change @@ -62,11 +62,11 @@ Public Class WinNUT
6262 Private Event On_Battery()
6363 Private Event On_Line()
6464 Private Event Data_Updated()
65- Private Shared Event UpdateNotifyIconStr( ByVal Reason As String , ByVal Message As String )
66- Private Shared Event UpdateBatteryState( ByVal Reason As String )
65+ Private Event UpdateNotifyIconStr( ByVal Reason As String , ByVal Message As String )
66+ Private Event UpdateBatteryState( ByVal Reason As String )
6767
6868 'Handle sleep/hibernate mode from windows API
69- Declare Function SetSystemPowerState Lib "kernel32 " ( ByVal fSuspend As Integer , ByVal fForce As Integer ) As Integer
69+ Declare Function SetSuspendState Lib "PowrProf " ( ByVal Hibernate As Integer , ByVal ForceCritical As Integer , ByVal DisableWakeEvent As Integer ) As Integer
7070
7171 Public Property UpdateMethod() As String
7272 Get
@@ -1039,9 +1039,9 @@ Public Class WinNUT
10391039 Case 0
10401040 Process.Start( "C:\WINDOWS\system32\Shutdown.exe" , "-f -s -t 0" )
10411041 Case 1
1042- SetSystemPowerState( True , 0 )
1042+ SetSuspendState( False , False , True ) 'Suspend
10431043 Case 2
1044- SetSystemPowerState( False , 0 )
1044+ SetSuspendState( True , False , True ) 'Hibernate
10451045 End Select
10461046 End Sub
10471047
You can’t perform that action at this time.
0 commit comments