Share via


GetDevicePower

This function returns the current power state for a device.

DWORD GetDevicePower(
  PVOID pvDevice, 
  DWORD dwDeviceFlags,
  PCEDEVICE_POWER_STATE pDeviceState
);

Parameters

  • pvDevice
    [in] Specifies the device. Must be a valid LPWSTR device name, for example, "COM1:". This parameter is interpreted according to dwDeviceFlags.
  • dwDeviceFlags
    [in] Set to POWER_NAME to specify the name of the device that is requesting the power request.
  • pDeviceState
    [out] Returns the device power state in CEDEVICE_POWER_STATE.

Return Values

  • ERROR_SUCCESS
    Successful.

Remarks

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

Including POWER_FORCE in dwDeviceFlags causes the Power Manager to issue an IOCTL_POWER_GET to the device rather than returning the internally cached power state for the named device.

Requirements

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

See Also

CEDEVICE_POWER_STATE

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.