• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

detecting/waking up from low power state?


This is a multi-part question:

1) If my app is running and processing WM_TIMER messages (say once every 5 seconds), and the machine goes in to a low power state, is my app still effectively running and processing the WM_TIMER messages?

2) How can I detect a low power state and have my application "wake up" the system from a low power state?

Thanks,

Don
0
dmetzler
Asked:
dmetzler
  • 3
  • 3
1 Solution
 
nietodCommented:
>> is my app still effectively running and
>> processing the WM_TIMER messages?
All "normal" operation is suspended.  You app is running, but sort of "frozen in place" and will resume operation when the system is resumed.

continues
0
 
nietodCommented:
>> How can I detect a low power state
The OS will send your application (ALL applications) a WM_POWER message with a PWR_SUSPENDREQUEST indication.   when the system resumes it sends a WM_POWER message with a PWR_SUSPENDRESUME indicato.  In some cases, it may not be able to send the PWR_SUSPENDREQUEST message and may just suspend the system.  In that case the WM_POWER Message will be sent when the system starts again, but the indication will be PWR_CRTICALRESUME

Let me know if you have any questions.
0
 
dmetzlerAuthor Commented:

So is there any way for an application to wake up the system?

Thanks,

Don
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
dmetzlerAuthor Commented:

And does the monitor power state work the same way as system power state?  If the monitor goes to low power mode, can a Win32 application restore monitor power?

Thanks,

Don
0
 
nietodCommented:
>> So is there any way for an application to wake up the system?
No everything is "frozen".  the current state of the computer is (RAM, registers etc) is written to some sort of nonvolatile storage (hard disk) and then the cpu is shut down (a special type of shut down, so it does not initialize the same when it is started again, actually the difference is probably only in the way it is started, not shut down.)  So the CPU is not doing anything, not programs are actually running, they are suspended in place until the CPU is started up again.

Now you can prevent the shutdown.

Interestingly, I've been reading the VC documentation and it seems to say that is wrong.  There is an "OnNow" feature of some computers that woudl allow the sleeping system to periodically check for things to be done (essentually it wakes up the CPU periodically and then lets it go back to sleep, so bassicall what I said was right, its just that these computers wake up and go back to sleep again and agin)   The docs don't mention anything specially you have to do to use this feature.  But it appears that all that it does when it (temporarily) wakes up is run the task scheduler to activate apps that are waiting on waitable timers.  So you will not get activated if you are using a "windows timer" (WM_TIMER) you need to be using on of the "multimedia timers".  (You also need to be using a computer with this feature.)

Do you have VC?  this is explained under "Power Management Overview" in the VC help.
0
 
dmetzlerAuthor Commented:

Yes - and thank you - I will look into this.

I have noticed that on one of my Win98 systems (laptop), that the scheduled ScanDisk can awake from a suspended state to do what it needs to do.  This confirms your note above.

Don
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now