GetSystemPowerStatus function kernel32

Win32Result<bool> GetSystemPowerStatus(
  1. Pointer<SYSTEM_POWER_STATUS> lpSystemPowerStatus
)

Retrieves the power status of the system.

The status indicates whether the system is running on AC or DC power, whether the battery is currently charging, how much battery life remains, and if battery saver is on or off.

To learn more, see learn.microsoft.com/windows/win32/api/winbase/nf-winbase-getsystempowerstatus.

Implementation

Win32Result<bool> GetSystemPowerStatus(
  Pointer<SYSTEM_POWER_STATUS> lpSystemPowerStatus,
) {
  final result_ = GetSystemPowerStatus_Wrapper(lpSystemPowerStatus);
  return Win32Result(value: result_.value.i32 != FALSE, error: result_.error);
}