4

Say, when a YouTube video is played via Google Chrome browser, or any video/sound in a Windows Media Player, both temporarily disable a screensaver if one is set up in a user's control panel. This happens only for the duration of the video being played or until the playback is paused.

Is there any way to know that screensaver (and power saving) was disabled in such a situation?

PS. I'm coding with C++.

c00000fd
  • 20,994
  • 29
  • 177
  • 400
  • What research have you done into the subject? – Mats Petersson Jul 30 '13 at 09:09
  • @MatsPetersson: My idea was to use SPI_GETSCREENSAVEACTIVE, but that doesn't seem to do the trick... – c00000fd Jul 30 '13 at 09:18
  • When the screen saver timeout expires the system sends a [`WM_SYSCOMMAND`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms646360.aspx) (with `SC_SCREENSAVE`) to all top level windows. To disable the screen saver an application typically responds to this message. I don't know of a way to discover this, other than bruteforcing it by sending a message to all top level windows. – IInspectable Jul 30 '13 at 10:07

1 Answers1

-1

There is a registry value that will disable the screensaverUser.

The key is at: HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop

Its name is: ScreenSaveActive

The key type is: REG_DWORD (DWORD Value)

To disable screen saver set the value to 0, when your application is done set it back to 1

If the key is not there just create one. To edit the registry through C++ there are a few steps.

Hope this helps