次の方法で共有


BatteryPDDGetStatus (Compact 2013)

3/26/2014

This function obtains the most current battery and power status available on the platform. It fills in the structures pointed to by its parameters.

Syntax

BOOL WINAPI BatteryPDDGetStatus(
  PSYSTEM_POWER_STATUS_EX2 pstatus,
  PBOOL pfBatteriesChangedSinceLastCall
);

Parameters

  • pfBatteriesChangedSinceLastCall
    [out] Pointer to a flag that the function sets to TRUE if the user replaced or changed the system's batteries since the last call to this function. The battery drivers should only set this value to TRUE if the driver's BatteryDrvrSupportsChangeNotification implementation returns TRUE.

Return Value

Returns TRUE if successful. Returns FALSE if there is an error. On failure, this routine should record its failure reason using SetLastError.

Remarks

When implementing BatteryPDDGetStatus, the appropriate battery information fills in the SYSTEM_POWER_STATUS_EX2 structure. Declare a variable of type SYSTEM_POWER_STATUS_EX2 as a pointer to the return buffer containing the battery status information. The pfBatteriesChangedSinceLastCall parameter is a pointer to the flag and is set to TRUE if the user replaced or changed the system's batteries since the last call to this function.

To return additional battery information, such as information about an extra battery, provide a data buffer larger than SYSTEM_POWER_STATUS_EX2 in the GetSystemPowerStatusEx2 function. Any extra information must be added after the BatteryChemistry member of the SYSTEM_POWER_STATUS_EX2 structure. There must be support for this implemented in the battery driver, and the implementation of this support varies depending on the hardware platform.

Note

This function is statically linked to the battery driver MDD.

Requirements

Header

battimpl.h

See Also

Reference

Battery Driver Functions
BatteryDrvrSupportsChangeNotification

Other Resources

SYSTEM_POWER_STATUS_EX2