Search code examples
windowswinapiscreensaver

How to determine that a screensaver is running?


One solution that one could suggest is to periodically look for a special 'Screen-saver' desktop, and if it's present then count it as a running screensaver.

But apparently this is not the case for all screensavers as with some the mentioned desktop is always present.

Are there more reliable solutions for this?


Solution

  • I think the key is to identify the screensaver by its window class ("WindowsScreenSaverClass"). I found this page How do I start, detect and stop screen savers? that has some code examples and explanations.