Link to home
Start Free TrialLog in
Avatar of dapperry
dapperry

asked on

Setting 3D Text Screen Saver

Does anyone know how to set the text of the 3D Text screen saver via code? I have a request from an engaged co-worker who wants her screen saver to dynamically display the number of days to her wedding. I figure I could write a small vb program and put it in her startup folder, and it would be able to update the text when she logs into her machine in the morning.

TIA,

:) dapperry
ASKER CERTIFIED SOLUTION
Avatar of CarlJWhite
CarlJWhite

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vinnyd79
vinnyd79

This does the same thing without using the windows scripting host:

Option Explicit
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Const HKEY_CURRENT_USER = &H80000001
Private Const ERROR_SUCCESS = 0&
Private Const REG_SZ = 1
Private X As Long

Private Sub SaveString(Hkey As Long, strpath As String, strValue As String, strdata As String)
    Dim keyhand As Long
    Dim r As Long
    X = RegCreateKey(Hkey, strpath, keyhand)
    X = RegSetValueEx(keyhand, strValue, 0, REG_SZ, ByVal strdata, Len(strdata))
    X = RegCloseKey(keyhand)
End Sub

Private Sub Command1_Click()
Call SaveString(HKEY_CURRENT_USER, "Control Panel\Screen Saver.3DText", "Text", "Days till wedding!")
End Sub
Avatar of dapperry

ASKER

I tried CarlJWhite's method, and it works just fine. Thanks.

:) dapperry