Find out whether or not a laptop is running on battery power and if so how much battery time is rem
Find out whether or not a laptop is running on battery power and if so how much battery time is remaining.
API Declarations
Public Type SYSTEM_POWER_STATUS
ACLineStatus As Byte
BatteryFlag As Byte
BatteryLifePercent As Byte
Reserved1 As Byte
BatteryLifeTime As Long
BatteryFullLifeTime As Long
End Type
Rate Find out whether or not a laptop is running on battery power and if so how much battery time is rem
(1(1 Vote))
Dim SysStatus As SYSTEM_POWER_STATUS, LifeTime As Double
GetSystemPowerStatus SysStatus
LifeTime = SysStatus.BatteryLifeTime
If LifeTime = -1 Then
MsgBox "Using AC Power"
Else
MsgBox LifeTime / 3600 & " hours remaining"
End If
End Sub
Find out whether or not a laptop is running on battery power and if so how much battery time is rem Comments
No comments yet — be the first to post one!
Post a Comment