SPI_SETSCREENSAVETIMEOUT not working on Windows 7 using Python and ctypes
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.
精彩评论