コード例 #1
0
 public static void restoreSystemSleepState()
 {
     try
     {
         WindowsNativeMethods.SetThreadExecutionState(WindowsNativeMethods.EXECUTION_STATE.ES_CONTINUOUS);
     }
     catch (DllNotFoundException dnte)
     {
     }
     catch (EntryPointNotFoundException enfe)
     {
     }
 }
コード例 #2
0
 public static void PreventSystemFromSleeping()
 {
     try
     {
         fPreviousExecutionState = WindowsNativeMethods.SetThreadExecutionState(WindowsNativeMethods.EXECUTION_STATE.ES_CONTINUOUS | WindowsNativeMethods.EXECUTION_STATE.ES_AWAYMODE_REQUIRED | WindowsNativeMethods.EXECUTION_STATE.ES_SYSTEM_REQUIRED);
     }
     catch (DllNotFoundException dnte)
     {
     }
     catch (EntryPointNotFoundException enfe)
     {
     }
 }