[DllImport("powrprof.dll", SetLastError=true)]
public static extern UInt32 PowerDuplicateScheme(
IntPtr RootPowerKey,
ref Guid SrcSchemeGuid,
ref IntPtr DstSchemeGuid);
Declare Function PowerDuplicateScheme Lib "powrprof.dll" (TODO) As TODO
None.
Do you know one? Please contribute it!
None.
Please add some!
/// <summary>
/// Creates a new Power Policy based on the 'Balanced' Profile.
/// </summary>
/// <returns>
/// The GUID for the new policy if successful, otherwise a blank GUID is returned
/// </returns>
Guid CreateNewPowerPolicy()
{
Guid result = new Guid();
IntPtr RetrPointer = IntPtr.Zero;
// Attempt to duplicate the 'Balanced' Power Scheme.
NativeMethods.PowerDuplicateScheme(IntPtr.Zero, ref VISA_PM_BASIC_SCHEMES.BALANCED, ref RetrPointer);
if (RetrPointer != IntPtr.Zero)
{
// Function returns a pointer-to-memory, marshal back to our Guid variable.
result = (Guid)Marshal.PtrToStructure(RetrPointer, typeof(Guid));
}
return result;
}