We help IT Professionals succeed at work.

Changing the Windows Screen Saver

saulbehr
saulbehr asked
on
Does anyone know of any Windows APIs or any other methods that I can call from VB6 to change the Windows Screen Saver?
Comment
Watch Question

TimCotteeHead of Software Services
CERTIFIED EXPERT

Commented:
The screen saver is kept in a registry entry. Use registry API or the WSHShell if you have VB scripting support to set this key:

HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE

Author

Commented:
Thanks for the comment Tim - could you please give me a VB code sample?
:)
Saul
Head of Software Services
CERTIFIED EXPERT
Commented:
With the scripting host:

Dim wshShell As Object
Set wshShell = CreateObject("WScript.Shell")
wshShell.RegWrite = "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE","c:\MyFolder\MyScreensaver.scr"
Set wshShell = Nothing

This is the easiest method. If you would prefer API code for registry access I can give you this as well.

Author

Commented:
Answered my question exactly and it worked correctly.
Many thanks!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.