Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aborting System Sleep?

Status
Not open for further replies.

evarmint

Programmer
Jun 16, 2007
3
US
I would like to disable the system Sleep key that is found on modern keyboards. I tried overriding the WM_SYSKEYDOWN event, but somehow this key still makes it through and puts the system to sleep. Is there another way to disable this key?

Alternatively, is there a way I can abort a system shutdown that is in progress?
 
if you can capture the shutdown event through the windows API then you can simply launch the cmd process and pass it shutdown -a

This will abort the shutdown
 
I am still stuck here because the sleep event, if there is one, is not a shutdown event, nor is it a powerbroadcast event.

The only thing I have found is an article that says I can write a driver to filter the the keycaps request, but I think that is too heavyweight of a solution.

So the question remains: Is there a way for a windows application to prevent the system from going to sleep?
 
If you don't want the screen saver to pop up then consider moving the cursor 1 pixel every n minutes

You may be able to use the Windows API to set the Power Option for the computer to turn sleep to "never"

 
This is a different issue. Modern keyboards have that little moon-icon button which puts the system to sleep when the user presses it. I want to disable that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top