PowerDuplicateScheme (powrprof)
Last changed: anonymous

.
Summary
TODO - a short description

C# Signature:

[DllImport("powrprof.dll", SetLastError=true)]
    public static extern UInt32 PowerDuplicateScheme(
            IntPtr RootPowerKey,
            ref Guid SrcSchemeGuid,
            ref IntPtr DstSchemeGuid);

VB Signature:

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

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    /// <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;
    }

Documentation