■ SetThreadExecutionState API 함수를 선언하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
using System; using System.Runtime.InteropServices; #region 스레드 실행 상태 설정하기 - SetThreadExecutionState(state) /// <summary> /// 스레드 실행 상태 설정하기 /// </summary> /// <param name="state">실행 상태</param> /// <returns>실행 상태</returns> [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)] private static extern ExecutionState SetThreadExecutionState(ExecutionState state); #endregion /// <summary> /// 실행 상태 /// </summary> [FlagsAttribute] public enum ExecutionState : uint { /// <summary> /// ES_AWAYMODE_REQUIRED /// </summary> ES_AWAYMODE_REQUIRED = 0x00000040, /// <summary> /// ES_CONTINUOUS /// </summary> ES_CONTINUOUS = 0x80000000, /// <summary> /// ES_DISPLAY_REQUIRED /// </summary> ES_DISPLAY_REQUIRED = 0x00000002, /// <summary> /// ES_SYSTEM_REQUIRED /// </summary> ES_SYSTEM_REQUIRED = 0x00000001 } |