Jump to content

Detect if laptop is running on Battery or not...


Recommended Posts

  • 1 month later...

Can anyone point me in the right direction in determining if a laptop is running on a battey or not? Thanks in advance.

I recently needed to perform this action for an installation package I was tasked to build. I used the value of the following registry key to determine whether it was on AC or DC power. It worked for all of my instances, but may not work for yours.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Systray" "Services"

I believe this key determines if the battery indicator should appear in the System Tray. I found the DWORD value of '30' proved to be on AC power, and '31' proved to be on battery power.

Good luck!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...