2011-01-10, 01:27 AM
Sub, are you using awaymode? npvr really needs it while recording..
it prevents sleep modes and is made pretty much just for recording apps like this..
it's super simple to implement, just one call when recording, and another to clear those flags when done..
even if user hits sleep button it still enters away mode and screen blanks, but press any key and display comes back on...
if no user interaction and you clear flag when recording's done, system will go ahead and continue the sleep mode transition...so it kinda like pauses sleep mode till recordings are done, then sleeps...
also would prevent sleeping when resumed automatically for recordings....[not using enough cpu for windows to notice it still needs system..]
from rec service, call SetThreadExecutionState with ES_SYSTEM_REQUIRED + ES_CONTINUOUS + ES_AWAYMODE_REQUIRED [0x80000041]
to enter away mode when recording, and ES_CONTINUOUS [0x80000000] to clear it and let system suspend.. by using ES_CONTINUOUS, you only have to do it once till recording ends, when you clear it..works reliably from all my testing..
[actually i've been using this in a separate app i made, would be better built in]
and to prevent accidental shutdown while recording, use the ShutdownBlockReasonCreate and destroy which brings up that dialog so users do have a chance to force shutdown when need be, but it'll sit there forever till the reason is destroyed or user selects cancel or shutdown, and i was putting the name of recording in reason text so you could decide if recording was worth it..
i have working code for both, and it's not much to add..
works in vista/7 only, i know you were using ES_SYSTEM_REQUIRED in pvrx2, but it doesn't prevent sleep in vista/7..
since this app is best on vista/7, might as well make it modern...
let me know what you think..
and man, don't ya just hate it when the pets walk on the keyboard sleep key?
http://msdn2.microsoft.com/en-us/library/aa373208.aspx
it prevents sleep modes and is made pretty much just for recording apps like this..
it's super simple to implement, just one call when recording, and another to clear those flags when done..
even if user hits sleep button it still enters away mode and screen blanks, but press any key and display comes back on...
if no user interaction and you clear flag when recording's done, system will go ahead and continue the sleep mode transition...so it kinda like pauses sleep mode till recordings are done, then sleeps...
also would prevent sleeping when resumed automatically for recordings....[not using enough cpu for windows to notice it still needs system..]
from rec service, call SetThreadExecutionState with ES_SYSTEM_REQUIRED + ES_CONTINUOUS + ES_AWAYMODE_REQUIRED [0x80000041]
to enter away mode when recording, and ES_CONTINUOUS [0x80000000] to clear it and let system suspend.. by using ES_CONTINUOUS, you only have to do it once till recording ends, when you clear it..works reliably from all my testing..
[actually i've been using this in a separate app i made, would be better built in]
and to prevent accidental shutdown while recording, use the ShutdownBlockReasonCreate and destroy which brings up that dialog so users do have a chance to force shutdown when need be, but it'll sit there forever till the reason is destroyed or user selects cancel or shutdown, and i was putting the name of recording in reason text so you could decide if recording was worth it..

i have working code for both, and it's not much to add..
works in vista/7 only, i know you were using ES_SYSTEM_REQUIRED in pvrx2, but it doesn't prevent sleep in vista/7..
since this app is best on vista/7, might as well make it modern...

let me know what you think..
and man, don't ya just hate it when the pets walk on the keyboard sleep key?

http://msdn2.microsoft.com/en-us/library/aa373208.aspx
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie