Private Function getRegistry(ByVal key As String, Optional ByVal defValue As String = "") As String
Try
Dim regKey As Microsoft.Win32.RegistryKey
Dim Ret As String
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey(Application.ProductName)
regKey.Close()
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\" & Application.ProductName, True)
Ret = regKey.GetValue(key, defValue)
regKey.Close()
Return Ret
Catch ex As Exception
End Try
End Function
Private Sub SaveRegistry(ByVal Key As String, ByVal value As String)
Try
Dim regKey As Microsoft.Win32.RegistryKey
Dim Ret As String
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey(Application.ProductName)
regKey.Close()
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\" & Application.ProductName, True)
regKey.SetValue(Key, value)
Ret = regKey.GetValue(Key, "")
regKey.Close()
Catch ex As Exception
End Try
End Sub
Dim tmpLng As Integer
tmpLng = SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1&, 0&, 0&)
'Get the user's previous preference for the marquee message.
Dim pRegKey As RegistryKey = Registry.CurrentUser
pRegKey = pRegKey.OpenSubKey("Software\\Test Screen Saver")
Dim val As Object = pRegKey.GetValue("Message")
pRegKey.Close()
lblMessage.Text = val.ToString