Back in my VB6 days, 19 years ago, there was a API declare to do this.
In VB.NET this class will do the reboot. Should not be difficult to port to Xojo.
[code]Public Class DeviceReboot
<DllImport(“coredll”)> _
Private Shared Function SetSystemPowerState( _
ByVal psState As String, _
ByVal StateFlags As Integer, _
ByVal Options As Integer) As Integer
End Function
Const POWER_STATE_ON As Integer = &H10000
Const POWER_STATE_OFF As Integer = &H20000
Const POWER_STATE_SUSPEND As Integer = &H200000
Const POWER_STATE_RESET As Integer = &H800000
Public Sub New()
End Sub
Public Function Reboot()
Try
SetSystemPowerState(Nothing, POWER_STATE_RESET, 0)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
End Function
hi Guys,
thanks for all the great tips and the excellent sample
It was all of these which tweeked my memory to something I used in the past
#If TargetWin32=true Then
Declare Function GetSystemMetrics Lib "User32" (Index As Integer) As Integer
Const SM_SHUTTINGDOWN = &h2000
If GetSystemMetrics(SM_SHUTTINGDOWN) <> 0 Then //Any non-zero value is "True"
'the system is shutting down
else
' the system is NOT shutting down
end if
#endif
I know I’m not smart enough to have discovered it myself so I cant take any of the credit
It may have even come from Aarons WFS