Solved

detecting/waking up from low power state?

Posted on 2000-04-02
6
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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