Click here to Skip to main content
15,940,271 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to detect, in my program, when screen blank is turned off.

What I have tried:

I'm using C++, and my target platform is Windows 7.
I have a fair amount of experience in WinAPI programming.

I would like to detect, in my program, when screen blank is turned off.
This is *not* the screen saver, but the actual screen blanking operation itself.
(i.e., on my current machine, I have screensaver set to None, and "Turn off the display" set to 15 minutes. It is the "Turn on the display" that I wish to detect.).

Can anyone give me advice on what message or event to look for, to handle this task?
Updated 21-Mar-17 18:10pm
Derell Licht 21-Mar-17 22:17pm    
Sadly, the Power-management functions don't appear to work for Windows 7,
only Win8 and later. It compiled and ran fine, but doesn't actually work.

1 solution

Okay, I found a solution that works with Windows 7 64bit.
I act on WM_SYSCOLORCHANGE ... This possibly is slightly over-kill, but since I'm trying to update the desktop icon colors whenever they get reset, this appears to work quite nicely...

I have a freeware (32-bit) application which utilizes this technique to restore desktop icon color whenever it is changed (I hope).

Application is available here:

source code is here:
GitHub - DerellLicht/ClearIcon: program which sits in Notification Tray, tries to keep desktop icon colors set[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900