Platform SDK: Hardware

GetDevicePowerState

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

BOOL GetDevicePowerState(
  HANDLE hDevice,    // device-context handle
  BOOL *pfOn         // receives power state
);

Parameters

hDevice
[in] Handle to an object on the device, such as a file or socket, or a handle to the device itself.
pfOn
[out] 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.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also

Power Management Overview, Power Management Functions, GetSystemPowerStatus