Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualshuma-gorath

Posted 12 April 2013 - 09:33 AM

i wonder what happens when the PC goes to sleep when the game is running? never tried it.   it handles lost device now, so it ought to come right back up when you wake up the PC, assuming it (windows) does a full save and restore of state on sleeping.

You can easily test this.  First, create a timer that times out after a short time, using SetTimer().  When you receive WM_TIMER, call KillTimer(), then call SetSuspendState() to make the system sleep, passing FALSE for all three arguments.  According to MSDN, calling SetSuspendState() on you UI thread is a blocking call, which means you should be able to invoke your recovery code right after.

 

EDIT: An alternative method is to do sleep manually, then handle the WM_POWERBROADCAST notification when the system awakens.


#2shuma-gorath

Posted 12 April 2013 - 09:31 AM

i wonder what happens when the PC goes to sleep when the game is running? never tried it.   it handles lost device now, so it ought to come right back up when you wake up the PC, assuming it (windows) does a full save and restore of state on sleeping.

You can easily test this.  First, create a timer that times out after a short time, using SetTimer().  When you receive WM_TIMER, call KillTimer(), then call SetSuspendState() to make the system sleep, passing FALSE for all three arguments.  According to MSDN, calling SetSuspendState() on you UI thread is a blocking call, which means you should be able to invoke your recovery code right after.

 

EDIT: An alternative method is to do sleep manually, then handle the WM_POWERBROADCAST notification when the system awakens.


#1shuma-gorath

Posted 12 April 2013 - 09:15 AM

i wonder what happens when the PC goes to sleep when the game is running? never tried it.   it handles lost device now, so it ought to come right back up when you wake up the PC, assuming it (windows) does a full save and restore of state on sleeping.

You can easily test this.  First, create a timer that times out after a short time, using SetTimer().  When you receive WM_TIMER, call KillTimer(), then call SetSuspendState() to make the system sleep, passing FALSE for all three arguments.  According to MSDN, calling SetSuspendState() on you UI thread is a blocking call, which means you should be able to invoke your recovery code right after.


PARTNERS