Solved

detecting/waking up from low power state?

Posted on 2000-04-02
6
253 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now