Beispiel #1
0
        private uint ReadDCBrightness()
        {
            uint val = 0;

            WindowsSevenNativeFunctions.PowerReadDCValueIndex(
                IntPtr.Zero,
                ref currentPowerScheme,
                ref this.GUID_VIDEO_SUBGROUP,
                ref this.GUID_VIDEO_BRIGHTNESS,
                ref val);

            return(val);
        }
Beispiel #2
0
        public static Guid GetActivePowerScheme()
        {
            IntPtr ptrActiveGuid = IntPtr.Zero;
            uint   res           = WindowsSevenNativeFunctions.PowerGetActiveScheme(IntPtr.Zero, ref ptrActiveGuid);

            if (res != 0)
            {
                throw new Exception("Error reading current power scheme. Native Win32 error code = " + res);
            }

            var activeSchemeGuid = (Guid)Marshal.PtrToStructure(ptrActiveGuid, typeof(Guid));

            return(activeSchemeGuid);
        }