开发者

SPI_SETSCREENSAVETIMEOUT not working on Windows 7 using Python and ctypes

开发者 https://www.devze.com 2023-02-19 15:09 出处:网络
I\'m using ctypes to call the SystemParametersInfo() API function to set the screen saver t开发者_运维技巧imeout value. It works fine on Windows XP but not on Windows 7. The code I\'m using is the fol

I'm using ctypes to call the SystemParametersInfo() API function to set the screen saver t开发者_运维技巧imeout value. It works fine on Windows XP but not on Windows 7. The code I'm using is the following:

import ctypes

user32 = ctypes.windll.LoadLibrary("user32")
user32.SystemParametersInfoA(15, 5, 0, 3)

The code invokes the screen saver every 5 seconds. Strangely enough, I can see that the registry location containing the timeout setting has been updated, even though the screen saver itself does not appear.

Any ideas?


That works absolutely fine for me. My guess is that you have no screensaver selected.

When I changed my settings and selected "(None)" as my screensaver then the call to SystemParametersInfo had no effect.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号