[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.
Syntax
BOOLEAN WINAPI SetActivePwrScheme(
__in UINT uiID,
__in_opt PGLOBAL_POWER_POLICY lpGlobalPowerPolicy,
__in_opt PPOWER_POLICY lpPowerPolicy
);
Parameters
- uiID [in]
-
The index of the power scheme to be activated.
- lpGlobalPowerPolicy [in, optional]
-
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.
- lpPowerPolicy [in, optional]
-
A pointer to an optional
POWER_POLICY structure, which provides power policy settings to be merged with the power scheme when it becomes active.
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
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.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | PowrProf.h |
| Library | PowrProf.lib |
| DLL | PowrProf.dll |
See Also
- GetActivePwrScheme
- GLOBAL_POWER_POLICY
- Power Management Functions
- POWER_POLICY
- Power Schemes
Send comments about this topic to Microsoft
Build date: 5/7/2009