[Implemented] Disable screensaver when lister plays video

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

[Implemented] Disable screensaver when lister plays video

Post by *Usher »

It's an obvious feature missing in a new media player: When playing video, screensaver should be disabled. Disabling of other power saving options (standby, hibernate on AC power etc.) is also welcome.
Last edited by Usher on 2021-05-21, 15:12 UTC, edited 1 time in total.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Disable screensaver when lister plays video

Post by *ghisler(Author) »

Sounds like a good idea, I will try adding it.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Disable screensaver when lister plays video

Post by *Usher »

History.ini wrote:27.04.21 Added: Prevent screen saver and sleep mode while playing video. Re-enable while paused or stopped (32/64)
It doesn't work in TC 10b8 in Windows XP 32-bit.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Disable screensaver when lister plays video

Post by *ghisler(Author) »

I'm using SetThreadExecutionState, which works well on Windows 10. Searching for
SetThreadExecutionState Windows XP
seems to indicate that the function is faulty on Windows XP and Vista.

I don't know what I should use instead - people seem to suggest all kinds of hacks like sending yourself fake keypresses or so...
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Disable screensaver when lister plays video

Post by *Usher »

2ghisler(Author)
What about direct editing registry?
It's "ScreenSaveActive" value in HKEY_CURRENT_USER\Control Panel\Desktop

EDIT:
You can store existing value, set "ScreenSaveActive" to 0 on video player start and restore saved value on player pause/stop/exit.
Last edited by Usher on 2021-04-30, 16:02 UTC, edited 1 time in total.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Disable screensaver when lister plays video

Post by *Horst.Epp »

Usher wrote: 2021-04-30, 15:02 UTC 2ghisler(Author)
What about direct editing registry?
It's "ScreenSaveActive" value in HKEY_CURRENT_USER\Control Panel\Desktop
A no go for a portable installation.
And we are talking about a dead OS
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Disable screensaver when lister plays video

Post by *Usher »

2Horst.Epp
It's NOT April 1st today.
Suggest a better solution or stop kidding, please.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Disable screensaver when lister plays video

Post by *Dalai »

2Usher
Changing such value in registry won't be applied without logging out and in again. Besides, it won't change anything in regards to the monitor going to sleep/standby.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Disable screensaver when lister plays video

Post by *Usher »

2Dalai
So how other players work? How changes from Control Panel applet are applied?
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Disable screensaver when lister plays video

Post by *Dalai »

Blocking the Windows Screen Saver in Delphi including the links to StackOverflow in that article.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Disable screensaver when lister plays video

Post by *ghisler(Author) »

Thanks, these seem to be for newer systems only. But the linked StackOverflow article metions that we have to intercept WM_POWERBROADCAST to prevent the screen saver from running on XP, so I will try to add that.

Edit:
Unfortunately the WM_POWERBROADCAST method does not prevent the screen saver from starting, it only seems to prevent the sleep/hibernation of the system. Reacting to WM_SYSCOMMAND, SC_SCREENSAVE and returning -1 seems to work.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Disable screensaver when lister plays video

Post by *Usher »

2ghisler(Author)
It still doesn't work as expected in Windows XP. Running video in full screen kills screensaver blocking feature. Follow these steps:
1. Set screensaver delay to 1 minute.
2. Play video in Lister and wait 1 minute to ensure that screen saver won't be activated.
3. Double click the video to run it in full screen and wait another minute. Screen saver will start now.
4. Press Esc to stop screensaver, than press Esc again to go back to playing in Lister window. Wait one more minute and you will see screensaver active again.
You have to restart Lister to reactivate screensaver blocking.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Disable screensaver when lister plays video

Post by *petermad »

1. Set screensaver delay to 1 minute.
2. Play video in Lister and wait 1 minute to ensure that screen saver won't be activated.
3. Double click the video to run it in full screen and wait another minute. Screen saver will start now.
4. Press Esc to stop screensaver, than press Esc again to go back to playing in Lister window. Wait one more minute and you will see screensaver active again.
You have to restart Lister to reactivate screensaver blocking.
I can confirm this under Windows 7 x64
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Disable screensaver when lister plays video

Post by *ghisler(Author) »

I haven't tried in full screen so far, because I don't see a reason why it should be different. I will check it.

But does it work for you in normal (not full screen) mode? I tried it on Windows XP and 7, and the screen saver didn't activate until 1 minute after the video stopped.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Disable screensaver when lister plays video

Post by *Usher »

2ghisler(Author)
Screensaver blocking works OK as described in steps 1 and 2 - with normal and maximized Lister window.
Full screen is a special case (for example, no pop-up messages allowed) and should always be tested separately.
Andrzej P. Wozniak
Polish subforum moderator
Post Reply