Partager via


IOCTL_POWER_SET (Compact 2013)

3/26/2014

This I/O control requests a change from one device power state to another. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,          // handle to the device
    DWORD dwIoControlCode,   // use IOCTL_POWER_SET
    LPVOID lpInBuffer,       // pointer to input buffer
    DWORD nInBufferSize,     // input buffer size
    LPVOID lpOutBuffer,      // pointer to output buffer
    DWORD nOutBufferSize,    // output buffer size
    LPDWORD lpBytesReturned, // number of bytes returned
    OVERLAPPED lpOverlapped  // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device.
  • dwIoControlCode
    [in] The control code for the operation. Use IOCTL_POWER_SET for this operation.
  • lpInBuffer
    [in] Set to a pointer to a POWER_RELATIONSHIP structure. This defines the target device for parent and bus drivers. Otherwise, set to NULL.
  • nInBufferSize
    [in] Size of the POWER_RELATIONSHIP structure.
  • lpOutBuffer
    [in] Set to a pointer to CEDEVICE_POWER_STATE. This is the device power state in which to put the device.

    [out] Contains a pointer to a CEDEVICE_POWER_STATE structure representing the adjusted device power state chosen by the driver.

  • nOutBufferSize
    [out] Size of the CEDEVICE_POWER_STATE parameter.
  • lpBytesReturned
    [out] Number of bytes passed back in the lpOutBuffer buffer.

Return Values

Returns TRUE if successful; otherwise, returns FALSE.

Remarks

Power Manager sends this I/O control only to drivers that support the power management I/O controls.

All drivers that account for power must handle this I/O control.

The backlight driver must have a thread that waits for display interfaces.

Your application should not call this control directly to set the device power. Instead, it should use the SetDevicePower function which goes through the Power Manager.

Requirements

Header

pm.h

See Also

Reference

Power Management I/O Controls
CEDEVICE_POWER_STATE
POWER_RELATIONSHIP