[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
);
If the function succeeds, it returns a nonzero value. Otherwise, the function returns zero.
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.
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.
Power Management Overview, Power Management Functions, GetSystemPowerStatus