Prevent PC from sleeping

Where all the user feedback and suggestions for improvements go
Post Reply
archbish99
Posts: 1
Joined: Fri Oct 18, 2013 4:25 pm

Prevent PC from sleeping

Post by archbish99 » Fri Oct 18, 2013 4:39 pm

Just switching from ShowAnalyzer to ComSkip, and I notice that ComSkip doesn't appear to block sleep on the HTPC while it's analyzing. Have you considered simply calling SetThreadExecutionState (http://msdn.microsoft.com/en-us/windows ... s.85).aspx) to inform Windows you'd like the system to remain up? System would be a good choice; away mode is a bit debateable....

Of course, it appears to be enough faster than ShowAnalyzer that this may turn out not to be an issue. If it's set up to start detection while the show is recording, and then can continue detection while I'm watching it (and keep ahead of me) that's not necessarily a problem.

erik
Site Admin
Posts: 3302
Joined: Sun Aug 21, 2005 3:49 pm

Re: Prevent PC from sleeping

Post by erik » Sat Oct 19, 2013 1:37 pm

Good proposal

Will try to add to next build

Jagad
Posts: 130
Joined: Wed Dec 07, 2011 12:37 am

Re: Prevent PC from sleeping

Post by Jagad » Tue Nov 19, 2013 4:24 pm

Harder than it sounds to accomplish! At least for those using Win Vista/7/8. For XP users sleep/hibernation can be blocked.
For others if the winAPI have received a sleep/hibernation command no application can block it from be carried through.

The link even says so:
The SetThreadExecutionState function cannot be used to prevent the user from putting the computer to sleep. Applications should respect that the user expects a certain behavior when they close the lid on their laptop or press the power button.

Post Reply