Programmatically prevent Windows screensaver from starting

后端 未结 13 2010
心在旅途
心在旅途 2020-12-03 00:58

Is there a recommended way to prevent the Windows screensaver from starting? The closest thing I\'ve found is this article, but what I would really like to do is just tell

13条回答
  •  独厮守ぢ
    2020-12-03 01:41

    AutoHotkey can set SystemParametersInfo(SPI_SETSCREENSAVEACTIVE) with a 1-liner DllCall in script to easily accomplish this with a .ahk script.

    AutoHotkey code to disable Screensaver:

    DllCall("SystemParametersInfo", Int, 17, Int, 0, UInt, NULL, Int, 2)
    

    AutoHotkey code to enable screensaver:

    DllCall("SystemParametersInfo", Int, 17, Int, 1, UInt, NULL, Int, 2)
    

    Reference Forum Threads:

    F13Key - Toggling Screen Saver with SystemParametersInfo
    SKAN - How to Disable Screen Saver Temporarily

提交回复
热议问题