Screen Saver active?

Archives Forums/BlitzPlus Programming/Screen Saver active?

FirstTheIdea(Posted 2003) [#1]
Is there any way of knowing if someone computer is showing an screen saver and that is active?

Hansie(Posted 2003) [#2]
Try looking at the screen ;-)

Clyde(Posted 2003) [#3]
What seems to be the problem with screen savers mate?

xlsior(Posted 2003) [#4]
I would guess that he wants to automatically pause his program or something when the screensaver kicks in?

Perturbatio(Posted 2003) [#5]
From the win32 sdk

Once a screen saver is chosen, Windows monitors keystrokes and mouse movements, starting the screen saver after a period of inactivity. However, Windows does not start the screen saver if any of the following conditions exist:

· The active application is not a Windows-based application.
· A computer-based training (CBT) window is present.
· The active application receives the WM_SYSCOMMAND message with wParam set to the SC_SCREENSAVE value, but does not pass the message to the DefWindowProc function.

There doesn't appear to be a simple API command that just detects if the screensaver has been activated.

But you might be able to intecept the WM_SYSCOMMAND in some way, this would require more investigation however.

xlsior(Posted 2003) [#6]
Would it be possible to use some API call to look at all the running processes, and see if there is a .scr in there?

Perturbatio(Posted 2003) [#7]
having looked a little further, it might be possible with
SystemParametersInfo in conjunction with SPI_GETSCREENSAVEACTIVE

Perturbatio(Posted 2003) [#8]
ok, maybe not, this just tells you whether or not the screen saver feature is enabled, not if the screensaver is actually running.

xlsior(Posted 2003) [#9]
No idea if this is accurate, or how to implement it, but a quick internet search returned the following:

SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,.. returns 0 if there is a screensaver currently running and 1 if there is no screen saver running..

Perturbatio(Posted 2003) [#10]
it's innacurate, what the SPI_GETSCREENSAVEACTIVE does is test whether or not the screensaver option is enabled NOT whether it is running or not.

FirstTheIdea(Posted 2003) [#11]
I have found this out, can you help me to put this in blitz?

Just fill in some gaps M$ dont tell about screen savers

Perturbatio(Posted 2003) [#12]
OpenDesktop ONLY works under WinNT/2K/XP not win9x/ME

Actually that second link shows how to do it for both OS's, but I don't think you can do it in blitz without a userlib since the third parameter of SystemParametersInfo must be a pointer to a variable

Perturbatio(Posted 2003) [#13]
Working DLL here (~8kb zipped, 15kb unzipped)

@rtur(Posted 2007) [#14]
>Working DLL here (~8kb zipped, 15kb unzipped)

Does it works in 98/ME/XP/2000/Vista?