Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Prevent Sleep

Back to Forum: Tech Off
  • User profile image
    phreaks

    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
    W3bbo

    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.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.