Disabling Screen Saver and Power Options in C#

Not sure if there is a better .NET solution but here is how you could use that API: The required usings: using System.Runtime.InteropServices; The P/Invoke: public const uint ES_CONTINUOUS = 0x80000000; public const uint ES_SYSTEM_REQUIRED = 0x00000001; public const uint ES_DISPLAY_REQUIRED = 0x00000002; [DllImport(“kernel32.dll”, SetLastError = true)] public static extern uint SetThreadExecutionState([In] uint esFlags); And … Read more