Changeset 1562
- Timestamp:
- 1/18/2010 6:11:46 AM (3 years ago)
- Location:
- branches/eraser6/CodeReview/Eraser.Util
- Files:
-
- 1 added
- 1 edited
-
KernelApi.cs (modified) (2 diffs)
-
Power.cs (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.Util/KernelApi.cs
r1560 r1562 148 148 } 149 149 } 150 }151 152 /// <summary>153 /// Enables an application to inform the system that it is in use, thereby154 /// preventing the system from entering sleep or turning off the display155 /// while the application is running.156 /// </summary>157 /// <param name="executionState">The thread's execution requirements. This158 /// parameter can be one or more of the EXECUTION_STATE values.</param>159 /// <returns>If the function succeeds, the return value is the previous160 /// thread execution state.161 ///162 /// If the function fails, the return value is NULL.</returns>163 /// <remarks>The system automatically detects activities such as local keyboard164 /// or mouse input, server activity, and changing window focus. Activities165 /// that are not automatically detected include disk or CPU activity and166 /// video display.167 ///168 /// Calling SetThreadExecutionState without ES_CONTINUOUS simply resets169 /// the idle timer; to keep the display or system in the working state,170 /// the thread must call SetThreadExecutionState periodically.171 ///172 /// To run properly on a power-managed computer, applications such as fax173 /// servers, answering machines, backup agents, and network management174 /// applications must use both ES_SYSTEM_REQUIRED and ES_CONTINUOUS when175 /// they process events. Multimedia applications, such as video players176 /// and presentation applications, must use ES_DISPLAY_REQUIRED when they177 /// display video for long periods of time without user input. Applications178 /// such as word processors, spreadsheets, browsers, and games do not need179 /// to call SetThreadExecutionState.180 ///181 /// The ES_AWAYMODE_REQUIRED value should be used only when absolutely182 /// necessary by media applications that require the system to perform183 /// background tasks such as recording television content or streaming media184 /// to other devices while the system appears to be sleeping. Applications185 /// that do not require critical background processing or that run on186 /// portable computers should not enable away mode because it prevents187 /// the system from conserving power by entering true sleep.188 ///189 /// To enable away mode, an application uses both ES_AWAYMODE_REQUIRED and190 /// ES_CONTINUOUS; to disable away mode, an application calls191 /// SetThreadExecutionState with ES_CONTINUOUS and clears192 /// ES_AWAYMODE_REQUIRED. When away mode is enabled, any operation that193 /// would put the computer to sleep puts it in away mode instead. The computer194 /// appears to be sleeping while the system continues to perform tasks that195 /// do not require user input. Away mode does not affect the sleep idle196 /// timer; to prevent the system from entering sleep when the timer expires,197 /// an application must also set the ES_SYSTEM_REQUIRED value.198 ///199 /// The SetThreadExecutionState function cannot be used to prevent the user200 /// from putting the computer to sleep. Applications should respect that201 /// the user expects a certain behavior when they close the lid on their202 /// laptop or press the power button.203 ///204 /// This function does not stop the screen saver from executing.205 /// </remarks>206 public static ThreadExecutionState SetThreadExecutionState(207 ThreadExecutionState executionState)208 {209 return (ThreadExecutionState)NativeMethods.SetThreadExecutionState(210 (NativeMethods.EXECUTION_STATE)executionState);211 150 } 212 151 … … 268 207 } 269 208 } 270 271 public enum ThreadExecutionState272 {273 /// <summary>274 /// No specific state275 /// </summary>276 None = 0,277 278 /// <summary>279 /// Enables away mode. This value must be specified with ES_CONTINUOUS.280 ///281 /// Away mode should be used only by media-recording and media-distribution282 /// applications that must perform critical background processing on283 /// desktop computers while the computer appears to be sleeping.284 /// See remarks.285 ///286 /// Windows Server 2003 and Windows XP/2000: ES_AWAYMODE_REQUIRED is287 /// not supported.288 /// </summary>289 AwayModeRequired = (int)NativeMethods.EXECUTION_STATE.ES_AWAYMODE_REQUIRED,290 291 /// <summary>292 /// Informs the system that the state being set should remain in effect293 /// until the next call that uses ES_CONTINUOUS and one of the other294 /// state flags is cleared.295 /// </summary>296 Continuous = unchecked((int)NativeMethods.EXECUTION_STATE.ES_CONTINUOUS),297 298 /// <summary>299 /// Forces the display to be on by resetting the display idle timer.300 /// </summary>301 DisplayRequired = (int)NativeMethods.EXECUTION_STATE.ES_DISPLAY_REQUIRED,302 303 /// <summary>304 /// Forces the system to be in the working state by resetting the system305 /// idle timer.306 /// </summary>307 SystemRequired = (int)NativeMethods.EXECUTION_STATE.ES_SYSTEM_REQUIRED,308 309 /// <summary>310 /// This value is not supported. If ES_USER_PRESENT is combined with311 /// other esFlags values, the call will fail and none of the specified312 /// states will be set.313 ///314 /// Windows Server 2003 and Windows XP/2000: Informs the system that a315 /// user is present and resets the display and system idle timers.316 /// ES_USER_PRESENT must be called with ES_CONTINUOUS.317 /// </summary>318 UserPresent = (int)NativeMethods.EXECUTION_STATE.ES_USER_PRESENT319 }320 209 }
Note: See TracChangeset
for help on using the changeset viewer.
