Hi all,
I am running a lenghthy loop and I want to PREVENT the screen saver from running during the time the loop is being excecuted.
I can detect when the screen saver kicks off but I can't seem to disable it as soon as that happens.
I have tried many things including SendKeys and Mouse move evnts, setcursorPos ....to emulate an action but without any luck !
this is waht I have so far but the "SPI_SETSCREENSAVERRUNNING" doesn't work !
Code:
VB Code:
Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ ByRef lpvParam As Long, ByVal fuWinIni As Long) As Long Const SPI_SETSCREENSAVERRUNNING As Long = 97 Const SPI_GETSCREENSAVERRUNNING As Long = &H72 Public Sub TEST() Dim lngIsRunning As Long Do SystemParametersInfo SPI_GETSCREENSAVERRUNNING, vbNull, lngIsRunning, vbNull If CBool(lngIsRunning) Then 'THIS DOESN'T DISABLE SCREEN SAVER ! SystemParametersInfo SPI_SETSCREENSAVERRUNNING, 0, 0, 0 Exit Do End If Loop MsgBox "FINISH" End Sub
I have even used different SenMessage commands but nothing disables the screen saver !![]()
FYI, I am using WIN XP.
ANY HELP PLEASE ?
THANK YOU.




Reply With Quote