Screen Saver active?

BlitzPlus Forums/BlitzPlus Programming/Screen Saver active?

Is there any way of knowing if someone computer is showing an screen saver and that is active?

Try looking at the screen ;-)

What seems to be the problem with screen savers mate?

I would guess that he wants to automatically pause his program or something when the screensaver kicks in?

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.

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?

having looked a little further, it might be possible with
SystemParametersInfo in conjunction with SPI_GETSCREENSAVEACTIVE

ok, maybe not, this just tells you whether or not the screen saver feature is enabled, not if the screensaver is actually running.

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..

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.

I have found this out, can you help me to put this in blitz?

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q150/7/85.asp&NoWebContent=1

Just fill in some gaps M$ dont tell about screen savers
http://www.cs.unibo.it/~ljw1004/download/howtoscr.html

OpenDesktop ONLY works under WinNT/2K/XP not win9x/ME

*edit*
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

Working DLL here (~8kb zipped, 15kb unzipped)

>Working DLL here (~8kb zipped, 15kb unzipped)

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