Compartilhar via


DevicePowerNotify (Windows CE 5.0)

Send Feedback

This function requests that the Power Manager change the power state of a device.

DWORD DevicePowerNotify(PVOID pvDevice, CEDEVICE_POWER_STATE DeviceState, DWORD Flags);

Parameters

  • pvDevice
    [in] Specifies the device. Must be a valid LPWSTR device name, for example, COM1:.
  • DeviceState
    [in] Indicates the device power state specified in CEDEVICE_POWER_STATE.
  • Flags
    [in] Set to POWER_NAME to specify the name of the device that is requesting the power request.

Return Values

  • ERROR_INVALID_PARAMETER
    Returned if there is not a valid parameter.
  • ERROR_WRITE_FAULT
    Attempt to update the device power state failed.
  • ERROR_FILE_NOT_FOUND
    The device class or the device within the device class cannot be found.
  • Win32 error code
    Propagated from the IOCTL_POWER_SET call.

Remarks

When DevicePowerNotify 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.

A device driver can notify the Power Manager that it wants to change its device power level using this API. If no entity has requested a power level requirement for the device, then the power manager may issue an IOCTL_POWER_SET to the requested device power level. Drivers should not assume that successful calls to this function will result in an IOCTL_POWER_SET or that subsequent IOCTL_POWER_SET operations are a result of this call.

The Power Manager supports DevicePowerNotify requests from a device while processing IOCTL_POWER_CAPABILITIES. This allows devices that are set to be loaded at a device power state other than D0 to request that their power state value be updated immediately following registration with the Power Manager. As with any DevicePowerNotify function call, the request might not result in a device power state update. This depends on constraints imposed on the Power Manager by applications, as well as the system power state configuration.

Drivers that support power management should report their capabilities as accurately as possible during enumeration. From then on, they will receive requests from the Power Manager to get or change their device power states. Devices that can manage their own power should use DevicePowerNotify to request that the Power Manager change their device power state.

Requirements

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

See Also

CEDEVICE_POWER_STATE | IOCTL_POWER_SET

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.