Теперь это работает ... следуйте ниже, как я это сделал:
using System.Runtime.InteropServices;
[DllImport("powrprof.dll", EntryPoint = "PowerDuplicateScheme", SetLastError = true)]
public static extern UInt32 PowerDuplicateScheme(IntPtr RootPowerKey, ref Guid SrcSchemeGuid, ref IntPtr DstSchemeGuid);
public static Guid createNewPowerPlan()
{
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;
}
Спасибо за вашу помощь