[SetActivePwrScheme is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Applications written for Windows Vista and later should use PowerSetActiveScheme instead.]
Sets the active power scheme.
BOOLEAN SetActivePwrScheme( UINT uiID, PGLOBAL_POWER_POLICY pGlobalPowerPolicy, PPOWER_POLICY pPowerPolicy );
The index of the power scheme to be activated.
A pointer to an optional GLOBAL_POWER_POLICY structure, which provides global power policy settings to be merged with the power scheme when it becomes active.
A pointer to an optional POWER_POLICY structure, which provides power policy settings to be merged with the power scheme when it becomes active.
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.
Use this function to make long-term changes to the system configuration. To temporarily keep the system running while an application is performing a task, use the SetThreadExecutionState function.
If the power scheme specified by uiID does not exist, the function returns zero.
If lpGlobalPowerPolicy is NULL, the function uses the current global power policy settings set by WriteGlobalPwrPolicy. Otherwise, the settings in the specified structure replace the current global power policy settings.
If lpPowerPolicy is NULL, the function uses the current power policy settings for the power scheme. Otherwise, the settings in the specified structure replace the current power policy settings.
For more information on using PowrProf.h, see Power Schemes.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|