Page 1 of 1
Detect Screen Saver?
Posted: Wed Jul 27, 2005 3:38 am
by jacobmp92
Is there any code that can let you detect when the screen saver appears? Ive searched the WinAPI and MSDN, but I can not find anything such as WM_SCREENSAVE.
Any help would be greatly appreciated

Posted: Wed Jul 27, 2005 6:24 am
by Anden
Checks if workstation is locked (this part of the code is a hack, but there is NO "official" way to detect a locked machine) or if blanker is on (this part works only for w2k or "better"):
Code: Select all
Procedure.b CheckBlankerOrLock()
;Check if Desktop active, else it's locked or switched
If (GetForegroundWindow_() = 0) : ProcedureReturn #True : EndIf
;Check screensaver
SystemParametersInfo_(#SPI_GETSCREENSAVERRUNNING, 0, @SSaverIsActive.l, 0)
If (SSaverIsActive = #True) : ProcedureReturn #True : EndIf ;screensaver is running
ProcedureReturn #False
EndProcedure