Solved

detecting/waking up from low power state?

Posted on 2000-04-02
6
259 Views
Last Modified: 2013-12-03

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
Comment
Question by:dmetzler
  • 3
  • 3
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 200 total points
ID: 2678218
>> 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
 
LVL 22

Expert Comment

by:nietod
ID: 2678227
>> 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
 

Author Comment

by:dmetzler
ID: 2678914

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

Thanks,

Don
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:dmetzler
ID: 2678916

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
 
LVL 22

Expert Comment

by:nietod
ID: 2679708
>> 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
 

Author Comment

by:dmetzler
ID: 2680324

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question