Share via

SetPowerRequirement (Windows CE 5.0)

Send Feedback

This function notifies the power manager that an application has a specific device power requirement.

HANDLE SetPowerRequirement(PVOID pvDevice,CEDEVICE_POWER_STATE DeviceState,ULONG DeviceFlags,PVOID pvSystemState,ULONG StateFlags);


  • pvDevice
    [in] Specifies the device. Must be a valid LPWSTR device name, for example, "COM1:". The actual meaning is determined by the Flags parameter.
  • DeviceState
    [in] Specifies the minimum device power state, at which to maintain the device at from the CEDEVICE_POWER_STATE enumeration.
  • DeviceFlags
    [in] Bitwise-or of the following flags.
    Flag Description
    POWER_NAME Specifies the name of the device whose power should be maintained at or above the DeviceState level.
    POWER_FORCE Indicates that the requirement should be enforced even during a system suspend.
  • pvSystemState
    [in] If not set to null, indicates that the requirement should only be enforced for the named system power state.
  • StateFlags
    [in] Unused. Set to zero.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.


When SetPowerRequirement is called, qualify the name of your device with an associated class. For example, {8DD679CE-8AB4-43c8-A14A-EA4963FAA715}\DSK1: refers to a power-managed block device called DSK1. If no class qualification is present, the generic power-manageable class {A32942B7-920C-486b-B0E6-92A702A99B35} is assumed.

Applications and drivers should always explicitly release their power requirements as soon as they cease to be necessary. The Power Manager will automatically release the requirement if the calling process exits for any reason before ReleasePowerRequirement is called.

If multiple SetPowerRequirement calls have been made for a single device, the actual power requirement imposed by the Power Manager will be the higher power consuming one. For example, if one application requires at least device power state D1 and another requires at least device power state D2, the Power Manager will maintain the device at D1.


OS Versions: Windows CE .NET 4.0 and later.
Header: Pm.h.
Link Library: Coredll.lib.

See Also

CEDEVICE_POWER_STATE | ReleasePowerRequirement

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.