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

Regards
Sawamura

Recommended Answers

All 3 Replies

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 = " & _
    Format$(SysInfo1.BatteryFullTime)
    List1.AddItem "BatteryLifeTime = " & _
    Format$(SysInfo1.BatteryLifeTime)
    List1.AddItem "BatteryLifePercent = " & _
    Format$(SysInfo1.BatteryLifePercent / 100, _
    "Percent")
    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
commented: really appreceate that. +13
commented: Thank you sir. This code working so well. I really appreciated this +3
commented: I appreciated it too :) +3

Thank You Jx_Man
It's worked nicely :)

You're Welcome

commented: Nice +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.