View Single Post
Old August 27th, 2008, 06:21 PM   #47 (permalink)
Notre350z
1 Farad - Avg. Capacity
Notre350z's CarPC Specs
 
Join Date: Jul 2008
Location: France
Vehicle: Nissan 350Z
Posts: 24
Notre350z is on a distinguished road
I've made my investigation in the msdn documentation and i'm pretty sure that the handler you're using is wating for the message
WM_POWERBROADCAST with reason PBT_APMRESUMESUSPEND

BUT PBT_APMRESUMESUSPEND is fired only when triggered by an input (mouse,key,etc)

MSDN -> WM_POWERBROADCAST Message (Windows)

Here are the messages that centrafuse receives when suspending:

WM_POWERBROADCAST dwPowerEvent:PBT_APMQUERYSUSPEND dwData:00000001
WM_POWERBROADCAST dwPowerEvent:PBT_APMSUSPEND dwData:00000000

When resuming, centrafuse first receives this message :

WM_POWERBROADCAST dwPowerEvent:PBT_APMRESUMEAUTOMATIC dwData:00000000

Centrafuse is still frozen...

Then, the following message is received by centrafuse when i move my mouse or press a key, and then centrafuse wakes up.

WM_POWERBROADCAST dwPowerEvent:PBT_APMRESUMESUSPEND dwData:00000000

I think you could just forget the PowerModeChangedEventHandler of .Net and just track the WIN32 messages above in your WinProc function.

I mean :
PBT_APMSUSPEND => suspend
PBT_APMRESUMEAUTOMATIC => resume
PBT_APMRESUMESUSPEND => forget

What do you think ?

Last edited by Notre350z; August 27th, 2008 at 06:57 PM.
Notre350z is offline   Reply With Quote
The Following 4 Users Say Thank You to Notre350z For This Useful Post: