Archived

This topic is now archived and is closed to further replies.

zhang_zhou

About "Hibernate"...

Recommended Posts

Zerosignull    122
well when u computer restarts from hibernate its actually just reloading the state it was in so there is no point in having a message to tell u its restarted frm hibernating. What iu think u meen is when the program restatrs from Suspend?? like when the monitor is powered down with the hd and stuff? if thats the case

these are the defines for the messages (copdied from a windwos header)
#define WM_POWER 0x0048

/* wParam for WM_POWER window message and DRV_POWER driver notification */
#define PWR_OK 1 //well obvious
#define PWR_FAIL (-1) //this too
#define PWR_SUSPENDREQUEST 1 //can i shut donw?
#define PWR_SUSPENDRESUME 2 //Im resuming now
#define PWR_CRITICALRESUME 3 //dunno

~prevail by daring to fail~

Share this post


Link to post
Share on other sites
zhang_zhou    122
Anyway,thanks to the reply...

What my means was not the "when the program restatrs from Suspend",but actually was "when the program restatrs from hibernate"...

As you known,in MS Win2k/ME,you can select "Hibernate" from the shut down dialog to put you system into the "hibernation" mode,and next time,we call it "the system will resume from the hibernation"...

Currently,what my problem is - If the user select Hibernate to put the system into the Hibernation mode,and at that time,my program is still running,that is,at the next time,when the system resume from the last hibernation states,my program will continue to run,but in this time,my program must do some special task,such as re-initialize some core data,therefore,I must know that when the system is resume from the hibernation and do this task...

So,what my real question is - How can I know whether the system is resume from "Hibernation"?

Thanks...

Share this post


Link to post
Share on other sites
Zerosignull    122
Dude u should go have alook at microsfts web sote for this. im guesing though that u will prberbly need the newest veriosn of the platform SDK depending on what compiler u got. i have ms vc++ 6 sp5 and my windows header files are for beta versopns of windows 98 (beta 2.1) and nt5 (win 2k)

~prevail by daring to fail~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
for your computer to Hibernate, it essentially saves the states of all the devices in the computer then saves all the memory that is in use to disk.

So it loads your data back for you. you don''t have to do anything... try it.

Share this post


Link to post
Share on other sites
Zerosignull    122
ok i thin i got how to get ure prog to fiund out what u want

message = WM_POWERBROADCAST

wParam = PBT_APMRESUMECRITICAL

WM_POWERBROADCAST is a notification to the program about the Power level the computer is TRYING to obtain. from what i can tell PBT_APMRESUMECRITICAL is that its trying to get into hibernation. return TRUE on this message to let the system continue to enter the requested state or return BROADCAST_QUERY_DENY to stop it from trying to enter the requested state. So now u can find out when ure computer is trying to hibernate. Now i THINK and i stress THINK that then

#define WM_POWER 0x0048

/* wParam for WM_POWER window message and DRV_POWER driver notification */
#define PWR_OK 1 //well obvious
#define PWR_FAIL (-1) //this too
#define PWR_SUSPENDREQUEST 1 //can i shut donw?
#define PWR_SUSPENDRESUME 2 //Im resuming now
#define PWR_CRITICALRESUME 3 //dunno

must be relevant to the last change power eg. if the system has just resumed from a suspend then the PWR_SUSPENDRESUME message will be sent(and continue to be sent until it is chaged ??) and for u and what u want the PWR_CRITICALRESUME will be sent after a hibination.(this may be wrong but its worth a shot) post another message if u get it working i would like to know how wrong i was


~prevail by daring to fail~

Share this post


Link to post
Share on other sites