Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Read/Write Boolean Values to and from Registry
- Private prodVer As String = Application.ProductVersion.toString.remove(3,4)
- 'useage
- If Not readkey() then
- 'do stuff
- writekey(true)
- End If
- 'subs & funcs
- Private Sub writeKey(ByVal dontShowChangeLog As Boolean)
- Dim k As RegistryKey
- k = Registry.CurrentUser.OpenSubKey("Software\" & Application.ProductName & "\" & prodVer, True)
- If dontShowChangeLog = True Then
- k.SetValue("DontShowChangeLog", "True")
- Else
- k.SetValue("DontShowChangeLog", "False")
- End If
- End Sub
- Private Function readkey() As Boolean
- Dim k As RegistryKey
- k = Registry.CurrentUser.OpenSubKey("Software\" & Application.ProductName & "\" & prodVer, True)
- If k Is Nothing Then
- k = Registry.CurrentUser.OpenSubKey("Software", True)
- k.CreateSubKey(Application.ProductName)
- k = k.OpenSubKey(Application.ProductName, True)
- k.CreateSubKey(prodVer)
- k = k.OpenSubKey(prodVer, True)
- k.SetValue("DontShowChangeLog", "False")
- End If
- If k.GetValue("DontShowChangeLog", "False") = "False" Then
- Return False
- ElseIf k.GetValue("DontShowChangeLog", "False") = "True" Then
- Return True
- End If
- Return Nothing
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement