WritePwrScheme function (powrprof.h)

[WritePwrScheme is no longer available for use as of Windows Vista. Instead, use the PowerEnumerate function to enumerate power settings for a specified scheme, and the power write functions to write individual settings.]

Writes policy settings that are unique to the specified power scheme.

Syntax

BOOLEAN WritePwrScheme(
  [in]           PUINT         puiID,
  [in]           LPCWSTR       lpszSchemeName,
  [in, optional] LPCWSTR       lpszDescription,
  [in]           PPOWER_POLICY lpScheme
);

Parameters

[in] puiID

The index of the power scheme to be written. If a power scheme with the same index already exists, it is replaced. Otherwise, a new power scheme is created.

[in] lpszSchemeName

The name of the power scheme.

[in, optional] lpszDescription

The description of the power scheme.

[in] lpScheme

A pointer to a POWER_POLICY structure that contains the power policy settings to be written.

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

This change does not affect the current system power policy. To apply this change to the current system power policy, call the SetActivePwrScheme function with the index of this power scheme.

Power policy schemes written using WritePwrScheme are permanently stored in the system registry hives, and remain available for use in the Power Options control panel program, or by subsequent calls to the power scheme API. To permanently remove a power scheme from the system, call the DeletePwrScheme function.

For more information about using PowrProf.h, see Power Schemes.

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

DeletePwrScheme

POWER_POLICY

Power Management Functions

Power Schemes

ReadPwrScheme

SetActivePwrScheme