VB Code:
Option Explicit Dim reg As cRegistry Private Sub SaveSettings() 'Writes to Registry Set reg = New cRegistry 'This will create a new value in the Run section 'so your program will automatically run when Windows starts 'This will create a new section to store your own keys in reg.ClassKey = HKEY_USERS reg.SectionKey = ".DEFAULT\Control Panel\Desktop" reg.ValueKey = "Wallpaper" reg.ValueType = REG_SZ reg.Value = CLng(Text2.Text) End Sub Private Sub GetSettings() 'Reads the Registry Set reg = New cRegistry reg.ClassKey = HKEY_USERS reg.SectionKey = ".DEFAULT\Control Panel\Desktop" reg.ValueKey = "Wallpaper" End Sub Private Sub Form_Load() Call GetSettings Text1.Text = reg.Value End Sub Private Sub Form_Unload(Cancel As Integer) SaveSettings End Sub
vbruntime error 13




Reply With Quote