Changeset 377
- Timestamp:
- 8/10/2008 9:22:15 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/EraserDll/Eraser.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/EraserDll/Eraser.cpp
r376 r377 2051 2051 eraserThread(LPVOID param1) 2052 2052 { 2053 // prevent the computer from going to sleep, since users tend to leave the computer 2054 // on overnight to complete a task. 2055 typedef EXECUTION_STATE (*WINAPI pSetThreadExecutionState)(EXECUTION_STATE esFlags); 2056 static pSetThreadExecutionState SetThreadExecutionState = NULL; 2057 if (!SetThreadExecutionState) 2058 { 2059 HMODULE kernel32 = LoadLibrary("kernel32.dll"); 2060 SetThreadExecutionState = reinterpret_cast<pSetThreadExecutionState>( 2061 GetProcAddress(kernel32, "_SetThreadExecutionState")); 2062 } 2063 class PreventComputerSleep 2064 { 2065 public: 2066 PreventComputerSleep() 2067 { 2068 if (!SetThreadExecutionState) 2069 return; 2070 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); 2071 } 2072 2073 ~PreventComputerSleep() 2074 { 2075 if (!SetThreadExecutionState) 2076 return; 2077 SetThreadExecutionState(ES_CONTINUOUS); 2078 } 2079 } SleepDeny; 2080 2053 2081 AFX_MANAGE_STATE(AfxGetStaticModuleState()); 2054 2082 eraserTraceBase("eraserThread\n");
Note: See TracChangeset
for help on using the changeset viewer.
