Is there any Windows application out there that will determine what process is preventing the screen saver from becoming active?
powercfg /requests from an Admin Command Prompt. For example, mine printed:
[DRIVER] Realtek High Definition Audio (HDAUDIO\FUNC_01&VEN_10EC&DEV_0900&SUBSYS_10438560&REV_1000\4&9793a48&0&0001)
An audio stream is currently in use.
Which indicates that Origin was playing a video and this was preventing the screensaver from running.
powercfg is built into windows and lets you control and view lots of power management settings.
powercfg -energy -trace
This will create a very detailed power management event log, energy-trace.etl. Open it with Event Viewer and filter log by Event Source: Kernel-Power, Include event ID: 62.
This should give you events that look like:
The application or service \Device\HarddiskVolume1\games\Steam\Steam.exe has overridden user power management settings with a code of 0x3.
The code may be different depending whether screensaver, monitor sleep, or another state transition was prevented.
Thanks to W1N9Zr0 for pointing me in the right direction!
In my case, it was an XP Pro (SP3) machine so the "energy" switch was not available, However, the "devicequery" switch indicated that it was either the mouse or the keyboard. Once I switched from the PS/2 keyboard I was using to a USB keyboard, the screensaver (and other power options) kicked in per the settings.
NOTE: When screensaver was set to 1 minute, it would sometimes kick in so I knew it was working. Anything above 1 minute and the screensaver would never kick in.
I find the culprit is typically a media player. You'd think it'd only be when playing video, but I have had some music players hold off the screen saver. For example I had Amazon Music and Groove open and paused today, and just found my screen still unlocked after an hour.
I'm not sure which is to blame, but I suspect them over the IDE and browser I was running, both of which do let the screen lock.
I don't know of any program that does this, but the way to find out is via the GetThreadExecutionState() function which will hold the value ES_DISPLAY_REQUIRED if the thread is currently blocking the screensaver from being activated.
If you apply this function to all of the threads in the system and then call GetProcessIdOfThread on the thread that you find, you'll have found the process that is blocking the screensaver.