Start New Discussion within our Software Development Community

How can i get battery status?
Any help will really appreciated.


You can use SysInfo Component to get information about battery status.
Project->Component->Microsoft SysInfo Control
Add it to Form and use this following codes :

Private Sub Form_Load()
    List1.AddItem "BatteryFullTime = " & _
    List1.AddItem "BatteryLifeTime = " & _
    List1.AddItem "BatteryLifePercent = " & _
    Format$(SysInfo1.BatteryLifePercent / 100, _
    Select Case SysInfo1.BatteryStatus
    Case 1
    List1.AddItem "BatteryStatus = HIGH"
    Case 2
    List1.AddItem "BatteryStatus = LOW"
    Case 4
    List1.AddItem "BatteryStatus = CRITICAL"
    Case 128
    List1.AddItem "BatteryStatus = NO BATTERY"
    Case 255
    List1.AddItem "BatteryStatus = UNKNOWN"
    End Select
End Sub
I appreciated it too :)
Thank you sir. This code working so well. I really appreciated this
really appreceate that.
This question has already been answered. Start a new discussion instead.