Detect Screen Saver?

Just starting out? Need help? Post your questions and find answers here.
jacobmp92
User
User
Posts: 26
Joined: Mon May 16, 2005 2:30 am
Location: Ohio > USA
Contact:

Detect Screen Saver?

Post 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 :)
PB 3.94
Anden
Enthusiast
Enthusiast
Posts: 135
Joined: Mon Jul 21, 2003 7:23 am
Contact:

Post 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
Post Reply