Export (0) Print
Expand All
Expand Minimize

SetActivePwrScheme function

[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 XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

PowrProf.h

Library

PowrProf.lib

DLL

PowrProf.dll

See also

GetActivePwrScheme
GLOBAL_POWER_POLICY
Power Management Functions
POWER_POLICY
Power Schemes

 

 

Community Additions

ADD
Show:
© 2014 Microsoft