PowerSetActiveScheme (powrprof)
Last changed: -

Sets the active power scheme for the current user.

C# Signature:

static extern uint PowerSetActiveScheme (IntPtr userRootPowerKey, ref Guid schemeGuid);

VB Signature:

Declare Function PowerSetActiveScheme Lib "powrprof.dll" (TODO) As TODO

User-Defined Types:


Alternative Managed API:

Do you know one?  Please contribute it!


Returns ERROR_SUCCESS (zero) if the call was successful, and a nonzero value if the call failed.

Tips & Tricks:

Please add some!

Sample Code:

public static void PowerSetActiveScheme (Guid schemeGuid)
     uint result = PowerSetActiveScheme(IntPtr.Zero, ref schemeGuid);
     result (res != 0) throw new COMException($"Error occurred. Win32 error code: {res}");