Share via


SetSystemPowerState (Windows Embedded CE 6.0)

1/6/2010

This function sets the system power state to the requested value.

Syntax

DWORD SetSystemPowerState(
  LPCWSTR psState,
  DWORD StateFlags,
  DWORD Options
);

Parameters

  • psState
    [in] Names the desired system state to enter. If this parameter is not NULL, the StateFlags parameter is ignored.
  • StateFlags
    [in] Optional. If the psState parameter is NULL, it names the system power state using the POWER_STATE_XXX flags defined in the Pm.h header file.

    The following table shows possible values.

    Flag Description

    POWER_STATE_BOOT

    Boot state.

    POWER_STATE_CRITICAL

    Critical state.

    POWER_STATE_IDLE

    Idle state.

    POWER_STATE_OFF

    Off state.

    POWER_STATE_ON

    On state.

    POWER_STATE_PASSWORD

    Password protected power state.

    POWER_STATE_RESET

    Reset state.

    POWER_STATE_SUSPEND

    Suspended state.

  • Options
    [in] Uses the optional POWER_FORCE flag to indicate that the state transfer is urgent. The interpretation of this flag is platform-dependent.

Return Value

  • ERROR_SUCCESS
    Indicates that the system power state has been set successfully.
  • Win32 error code
    Indicates that the system power state was not set.

Remarks

If the requested power state transition causes the system to be suspended, this function returns only after system operation resumes and related PBT_RESUME messages have been broadcast in the POWER_BROADCAST structure. Some platforms may restrict which system power states can be set by applications.

System power states define maximum device power levels for all power-manageable devices in the system. If a device is already at or below the maximum power level mandated by the new system power state, the device power state is not updated.

If a system call explicitly puts the device into an idle state, an appropriate wake source event must be implemented on the target device to activate the device when an application calls SetSystemPowerState(POWER_STATE_SUSPEND).**

See Also

Reference

POWER_BROADCAST

Concepts

Power States

Other Resources

Power Management Functions