Previous | Next |
The GetPowerSource method retrieves the power source and the percent of power remaining for the device.
Syntax
HRESULT GetPowerSource(
DWORD* pdwPowerSource,
DWORD* pdwPercentRemaining
);
Parameters
pdwPowerSource
[out] Pointer to a double word containing 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 double word containing the percentage of power remaining at the device. However, this is valid only if pdwPowerSource contains the WMDM_POWER_PERCENT_AVAILABLE flag.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
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.
See Also
Previous | Next |