IWMDMDevice::GetPowerSource method (mswmdm.h)

The GetPowerSource method retrieves information about the power source and the percentage of power remaining for the device.

Syntax

HRESULT GetPowerSource(
  [out] DWORD *pdwPowerSource,
  [out] DWORD *pdwPercentRemaining
);

Parameters

[out] pdwPowerSource

Pointer to a DWORD specifying information about the power source of the device.

The possible returned values are a bitwise OR of one or more of the following values.

Flag Description
WMDM_POWER_CAP_BATTERY The media device can run on batteries.
WMDM_POWER_CAP_EXTERNAL The media device can run on external power.
WMDM_POWER_IS_BATTERY The media device is currently running on batteries.
WMDM_POWER_IS_EXTERNAL The media device is currently running on external power.
WMDM_POWER_PERCENT_AVAILABLE The percentage of power remaining was returned in pdwPercentRemaining.

[out] pdwPercentRemaining

If pdwPowerSource contains WMDM_POWER_PERCENT_AVAILABLE, a pointer to a DWORD specifying the percentage of power remaining in the device.

Return value

The method returns an HRESULT. All the interface methods in Windows Media Device Manager can return any of the following classes of error codes:

  • Standard COM error codes
  • Windows error codes converted to HRESULT values
  • Windows Media Device Manager error codes
For an extensive list of possible error codes, see Error Codes.

Requirements

Requirement Value
Target Platform Windows
Header mswmdm.h
Library Mssachlp.lib

See also

IWMDMDevice Interface