Previous | Next |
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 double word 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. |
[out] pdwPercentRemaining
If the device is running on batteries, pdwPercentRemaining specifies a pointer to a double word containing the percentage of total battery power remaining.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Description |
E_INVALIDARG | A parameter is an invalid or NULL pointer. |
E_FAIL | An unspecified error occurred. |
Remarks
Only physical devices report power source capabilities and current power source. Software implementations of devices report no capabilities or current power source.
See Also
Previous | Next |