IWMDMDevice::GetPowerSource
The GetPowerSource method retrieves information about the power source and the percentage of power remaining for the device.
Syntax
HRESULT GetPowerSource(
DWORD* pdwPowerSource,
DWORD* pdwPercentRemaining
);
Parameters
pdwPowerSource
[out] Pointer to a DWORD containing information about the power source of the device.
The possible values returned in pdwPowerSource are provided in the following table.
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] Pointer to a DWORD containing the percentage of power remaining in the device; however, this value is valid only if pdwPowerSource contains the WMDM_POWER_PERCENT_AVAILABLE flag.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider 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 a complete 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 | One of the parameters is an invalid or NULL pointer. |
WMDM_E_NOTSUPPORTED | The device cannot provide this information. |
E_FAIL | An unspecified error occurred. |
Remarks
Only physical devices report power source capabilities and current power source. Software implementations of devices report neither capabilities nor current power source.
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also