SetPowerRequirement

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function notifies Power Manager that an application has a specified device power requirement.

Syntax

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

Parameters

  • pvDevice
    [in] Specifies the device. Must be a valid LPWSTR device name, for example, "COM1:". The meaning is determined by the Flags parameter.
  • DeviceState
    [in] Specifies the minimum device power state from the CEDEVICE_POWER_STATE enumeration at which to maintain the device.
  • DeviceFlags
    [in] Bitwise-OR of the following flags.

    Flag Description

    POWER_FORCE

    Indicates that the requirement should be enforced even during a system suspend.

    POWER_NAME

    Specifies the name of the device whose power should be maintained at or above the DeviceState level.

  • 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 Value

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

Remarks

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. Power Manager automatically releases 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 Power Manager is the one that consumes more power. For example, if one application requires at least device power state D1 and another requires at least device power state D2, Power Manager maintains the device at D1.

See Also

Reference

CEDEVICE_POWER_STATE
ReleasePowerRequirement

Other Resources

Power Management Functions