Some old, and slightly freaky, code...
?Win32
Extern "win32"
Function SystemParametersInfo(uiAction, uiParam, pvParam:Byte Ptr, fWinIni) = "SystemParametersInfoA@16"
End Extern
Const SPI_GETSCREENSAVEACTIVE = $10
Const SPI_SETSCREENSAVEACTIVE = $11
Const SPI_GETLOWPOWERACTIVE = $53
Const SPI_GETPOWEROFFACTIVE = $54
Const SPI_SETLOWPOWERACTIVE = $55
Const SPI_SETPOWEROFFACTIVE = $56
?
'---------------------------------- TEST ------------------------------------
Graphics 800, 600
ControlIdleResponse True
startTime = MilliSecs()
Repeat
Cls
Local hours = (MilliSecs() - startTime) / 3600000
Local minutes = ((MilliSecs() - startTime) / 60000) Mod 60
Local seconds = ((MilliSecs() - startTime) / 1000) Mod 60
DrawText "Time Elapsed = " + hours + ":" + minutes + ":" + seconds, 320, 294
'FlushMem
Flip
Until KeyHit(KEY_ESCAPE)
End
'---------------------------------- TEST ------------------------------------
Function ControlIdleResponse(enable=False, powerSave=False, powerOff=False, screenSaver=False)
?Win32
Global oldPowerSave:Byte, oldPowerOff:Byte, oldScreenSaver:Byte, first = True
If enable
If first
SystemParametersInfo(SPI_GETLOWPOWERACTIVE, Null, Varptr(oldPowerSave), Null)
SystemParametersInfo(SPI_GETPOWEROFFACTIVE, Null, Varptr(oldPowerOff), Null)
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, Null, Varptr(oldScreenSaver), Null)
OnEnd ControlIdleResponseReset
first = False
EndIf
Else
powerSave = oldPowerSave
powerOff = oldPowerOff
screenSaver = oldScreenSaver
EndIf
If first = False
SystemParametersInfo(SPI_SETLOWPOWERACTIVE, powerSave, Null, Null)
SystemParametersInfo(SPI_SETPOWEROFFACTIVE, powerOff, Null, Null)
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, screenSaver, Null, Null)
EndIf
?
End Function
Function ControlIdleResponseReset()
ControlIdleResponse False
End Function
AFAIR, the GL graphics driver dumps the screen saver messages but the DX driver doesn't.