SetSuspendState function (powrprof.h)

Suspends the system by shutting power down. Depending on the Hibernate parameter, the system either enters a suspend (sleep) state or hibernation (S4).

Syntax

BOOLEAN SetSuspendState(
  [in] BOOLEAN bHibernate,
  [in] BOOLEAN bForce,
  [in] BOOLEAN bWakeupEventsDisabled
);

Parameters

[in] bHibernate

If this parameter is TRUE, the system hibernates. If the parameter is FALSE, the system is suspended.

[in] bForce

This parameter has no effect.

[in] bWakeupEventsDisabled

If this parameter is TRUE, the system disables all wake events. If the parameter is FALSE, any system wake events remain enabled.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The calling process must have the SE_SHUTDOWN_NAME privilege. To enable the SE_SHUTDOWN_NAME privilege, use the AdjustTokenPrivileges function. For more information, see Changing Privileges in a Token.

An application may use SetSuspendState to transition the system from the working state to the standby (sleep), or optionally, hibernate (S4) state. This function is similar to the SetSystemPowerState function.

For more information on using PowrProf.h, see Power Schemes. For information about events that can wake the system, see System Wake-up Events.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header powrprof.h
Library PowrProf.lib
DLL PowrProf.dll

See also

PBT_APMQUERYSUSPEND

PBT_APMSUSPEND

Power Management Functions