IMDSPDevice::GetPowerSource (deprecated)

banner art

This is preliminary documentation and subject to change.

This topic documents a feature of the Windows Media Device Manager SDK. We recommend that you migrate your application to use the Windows Portable Devices API. For more information, see the Windows Portable Devices SDK.

The GetPowerSource method reports whether the device is capable of running on batteries, external power, or both, and on which type of power source it is currently running. If the device is running on batteries, this method also reports the percentage of total power remaining in the batteries.

Syntax

HRESULT GetPowerSource(
  DWORD*  pdwPowerSource,
  DWORD*  pdwPercentRemaining
);

Parameters

pdwPowerSource

[out] Pointer to a DWORD that receives a value indicating the current power source for the device. The value is one of the following flags.

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.

pdwPercentRemaining

[out] ** If the device is running on batteries, pdwPercentRemaining specifies a pointer to a DWORD containing the percentage of total battery power remaining.

Return Values

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 extenstive list of possible error codes, see Error Codes.

Possible values include, but are not limited to, those in the following table.

Return code Description
E_INVALIDARG A parameter is an invalid or NULL pointer.
E_FAIL An unspecified error occurred.
WMDM_E_NOTSUPPORTED The device cannot report power capabilities.

Remarks

Only physical devices report power source capabilities and current power source. Software implementations of devices report no power capabilities or current power source.

This method is optional. For more information, see Mandatory and Optional Interfaces.

Requirements

Header: Defined in mswmdm.h.

Library: mssachlp.lib

See Also