标签:epo read imp ade epc bsp 恢复 sleep splay
阻止系统休眠
using System.Runtime.InteropServices; static class WinSleepCtr { //定义API函数 [DllImport("kernel32.dll")] static extern uint SetThreadExecutionState(uint esFlags); const uint ES_SYSTEM_REQUIRED = 0x00000001; const uint ES_DISPLAY_REQUIRED = 0x00000002; const uint ES_CONTINUOUS = 0x80000000; public static void SleepCtr(bool sleepOrNot) { if (sleepOrNot) { //阻止休眠时调用 SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED); } else { //恢复休眠时调用 SetThreadExecutionState(ES_CONTINUOUS); } } }
标签:epo read imp ade epc bsp 恢复 sleep splay
原文地址:http://www.cnblogs.com/tabz/p/6431973.html