Tech Off Thread

2 posts

Prevent Sleep

Back to Forum: Tech Off
  • User profile image

    Looking for a way for a service to prevent a windows box from sleeping.

    Is the SetThreadExecutionState api call the only way via .NET (C# or F#)?

  • User profile image

    A cursory search of the Internet shows that SetThreadExecutionState is the officially-mandated way to prevent the screensaver from appearing or the system from entering sleep, standby, or hibernate. The function works by resetting the system's idle timer.

    It's one of those cases where the name of the function does not reflect its actual utility.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.