Created
November 6, 2010 13:53
-
-
Save aont/665438 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| using System.Runtime.InteropServices; | |
| using System.Diagnostics; | |
| namespace StandByPreventor | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| SetThreadExecutionState(ExecutionState.SystemRequired | ExecutionState.Continuous); | |
| } | |
| [DllImport("kernel32.dll")] | |
| extern static ExecutionState SetThreadExecutionState(ExecutionState esFlags); | |
| } | |
| [FlagsAttribute] | |
| public enum ExecutionState : uint | |
| { | |
| // 関数が失敗した時の戻り値 | |
| Null = 0, | |
| // スタンバイを抑止 | |
| SystemRequired = 1, | |
| // 画面OFFを抑止 | |
| DisplayRequired = 2, | |
| // 効果を永続させる。ほかオプションと併用する。 | |
| Continuous = 0x80000000, | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment