Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------REG_FUNCT_OLD
- ---------------------------------------
- Imports Microsoft.Win32
- Public Class Reg_Funcs
- Public Shared Function Write_Reg(ByVal Branch As String, ByVal Key As String, ByVal Val As String, Optional ByVal overwrite As Boolean = False) As Boolean
- Write_Reg = False
- Dim RK As RegistryKey
- RK = Registry.CurrentUser.OpenSubKey(Branch, True)
- If RegKey_Exists(Branch, Key) = False Then
- RK.SetValue(Key, Val)
- Write_Reg = True
- Else
- If overwrite = True Then
- RK.SetValue(Key, Val)
- Write_Reg = True
- Else
- Write_Reg = False
- End If
- End If
- RK.Close()
- End Function
- Public Shared Function Delete_Reg(ByVal Branch As String, ByVal Key As String) As Boolean
- Delete_Reg = False
- Dim RK As RegistryKey
- If RegKey_Exists(Branch, Key) = True Then
- RK = Registry.CurrentUser.OpenSubKey(Branch, True)
- RK.DeleteValue(Key)
- RK.Close()
- Delete_Reg = True
- Else
- Delete_Reg = False
- End If
- End Function
- Public Shared Function Read_Reg(ByVal Branch As String, ByVal Key As String) As String
- Read_Reg = ""
- Dim RK As RegistryKey
- RK = Registry.CurrentUser.OpenSubKey(Branch, True)
- If RegKey_Exists(Branch, Key) = True Then
- Read_Reg = RK.GetValue(Key)
- Else
- Read_Reg = ""
- End If
- RK.Close()
- End Function
- Public Shared Function RegKey_Exists(ByVal Branch As String, ByVal Key As String) As Boolean
- RegKey_Exists = False
- Dim RK As RegistryKey
- RK = Registry.CurrentUser.OpenSubKey(Branch, True)
- If Not RK.GetValue(Key) = "" Then
- RegKey_Exists = True
- Else
- RegKey_Exists = False
- End If
- RK.Close()
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement