C#: How to prevent a laptop from going into Stand-By

后端 未结 1 1727
臣服心动
臣服心动 2021-01-02 08:46

How can I do this in a C# program? I\'m pretty sure it should be possible, since various media programs for example do this so the computer doesn\'t go into stand-by while w

相关标签:
1条回答
  • 2021-01-02 09:16

    I think you'll have to P/Invoke. But don't be scared... it's pretty easy.

    SetThreadExecutionState is your friend. It's available in the PInvoke project, also available on NuGet.

    0 讨论(0)
提交回复
热议问题