On Wed, 31 Oct 2012 07:48:49 -0700 (PDT), bob <
b...@coolfone.comze.com>
wrote:
>Do programmers actually try to ensure that their applications function correctly when the computer goes into sleep mode for 10 hours and then comes out?
>
>Or do they just hope no one puts the computer in sleep mode while their app is running?
Sure. Testing behavior during sleep/hibernate functions is a normal
part of release testing. If the applications requires special
handling for those, or can't support sleep/hibernate at all, the
system provides functions for dealing with that. For example, in
Windows, you can register to be notified of a pending power state
change with a WM_POWERBROADCAST message , and you can tell the system
that a thread can/cannot be suspended with SetThreadExecutionState()
(post-XP, the power management stuff is a bit different in XP*).
*In XP you can respond "no" to the WM_POWERBROADCAST, and while that's
still supported in Vista/Win7/Win8, it's not the preferred approach.