I have an application than disables the screen saver temporarily in order to run a slide show. I use this to turn it on or off:
i = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, active, Nothing, SPIF_SENDWININICHANGE)
This works fine in XP. In Windows 7, it disables the screen saver properly. However, when it is enabled again, at the normal time for the screen saver to come on, the system asks for a password instead of showing the screen saver.
From this time on until the screen saver settings are adjusted in the control panel, the password screen is displayed in place of the screen saver.
Is there something else I should be doing for Windows 7? I understand that SPI_GETSCREENSAVEACTIVE is not supported in Windows 7, but SPI_SETSCREENSAVEACTIVE is supposed to be.
In Windows 7 and Vista, from the Start menu, click Control Panel. In the Control Panel, click Appearance and Personalization. Under "Personalization", click Change screen saver. In the "Screen saver" section of the resulting window, from the pull-down menu, select your desired screen saver.
Go to Settings > Personalization > Lock screen, and select Screen saver settings. In the Screen Saver Settings window, choose a screen saver from the drop-down list.
Right-click on the desktop, choose Personalize, and then click on Screen Saver on the bottom right-hand side of the window.
The solution is to change the registry value HKCU\Control Panel\Desktop ScreenSaveActive key instead of using SystemParametersInfo. This works in both XP and Windows 7.
Call Registry.SetValue("HKEY_CURRENT_USER\Control Panel\Desktop", "ScreenSaveActive", "1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With