GetDevicePowerState

[This is preliminary documentation and subject to change.]

The GetDevicePowerState function retrieves the current power state of the specified device.

BOOL GetDevicePowerState(
  HANDLE hDevice,     // device-context handle
  BOOL pfOn           // pointer to variable receiving power state
);
 

Parameters

hDevice
Handle to an object on the device, such as a file or socket, or a handle to the device itself.
pfon
Pointer to the variable that receives the power state. This value is TRUE if the device is fully on. Otherwise, it is FALSE.

Return Values

If the function succeeds, it returns a nonzero value. Otherwise, the function returns zero.

Remarks

An application can use GetSystemPowerState to determine whether a disk or other device is spun up. If the device is not spun up, the application should defer accessing it.

This function uses the IOCTL_GET_DEVICE_POWER_STATUS command to obtain the power state.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in winbase.h.
  Import Library: Use kernel32.lib.

See Also

Power Management Overview, Power Management Functions, GetSystemPowerStatus