Jump to content

_WinAPI_GetSystemPowerStatus doesnt detect charging


Recommended Posts

Hey there,

I just recently started to get into AutoIT since it might be usefull for deployment purposes.
Anyways.

I found the function _WinAPI_GetSystemPowerStatus and in its description it states that it should return a code 8, when the system is charging.

I copied the example code from the docs and gave it a try but it didnt seem to detect that my system is charging.

Is there anything I should know here to use it properly?

 

Thanks in advance 😀

Link to comment
Share on other sites

Link to comment
Share on other sites

It seems to work for me now too.

I just checked the windows documentation and it seems that the BatteryStatus has a status code 2, which is send back when the device runs directly using the energy from the powercable but isnt actually charging up the device.

So that might have been why it hasnt said that my device would be charging.

 

Quote

BatteryStatus
Unknown (2)

The system has access to AC so no battery is being discharged. However, the battery is not necessarily charging.

(https://learn.microsoft.com/en-US/windows/win32/cimwin32prov/win32-battery)

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...