[Psi-devel] A couple of SystemWatch related things

James Chaldecott james at swythan.co.uk
Mon Jun 25 11:31:05 PDT 2007


On 25/06/07, Remko Tronçon <remko at el-tramo.be> wrote:
>
> > It was mentioned when this stuff was done originally that we might want
> to
> > prevent going to sleep when a file transfer was in progress. I recently
> > discovered the SetThreadExecutionState API, which is the recommended way
> of
> > preventing the system idling to sleep (I think the *only* way on Vista).
> The
> > idea is that a program calls this API periodically during a
> > non-interruptible operation to reset the system idle timer.
>
> We probably want an 'allowSleep()' in systemwatch which does the right
> thing for every platform. On OS X, you prevent sleeping by reacting on
> the 'sleep' request. On windows, it would trigger a periodical call of
> this api.
>

Yeah, that would be good.

That Windows API does have an "until I say otherwise" version, but it
obviously leaves you vulnerable if you get your error handling wrong, or
something.

On XP you can cancel a sleep request a similar way (in the WM_POWERBROADCAST
handler), but they don't honour cancel requests it in Vista because it was
abused too much. Too many users with no battery left after they walked away
from or closed their laptop. :-(

I feel guilty now, because my company's software can do that to you at the
moment. :-/

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.affinix.com/pipermail/psi-devel-affinix.com/attachments/20070625/abd2659a/attachment.html 


More information about the psi-devel mailing list