VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Functions to read/write/delete a registry key (Very small code + No API's!)

by VB_Fanatic (2 Submissions)
Category: Registry
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 23rd September 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Functions to read/write/delete a registry key (Very small code + No API's!)

Rate Functions to read/write/delete a registry key (Very small code + No API's!)




Sub Main()
Dim RegObj, RegKey
Set RegObj = CreateObject("WScript.Shell")
RegKey = RegObj.RegRead("REGISTRY_KEY_TO_READ")
If RegKey = "" Then MsgBox "There is no registry value for this key!"
Else
MsgBox "Registry key value is " & RegKey & "!"
Set RegObj = Nothing
End If
End Sub

'Write a registry key

Sub Main()
Dim RegObj, RegKey As String
Set RegObj = CreateObject("WScript.Shell")
RegKey = "REGISTRY_KEY_TO_WRITE"
RegObj.RegWrite RegKey, "Value for the key goes here!"
Set RegObj = Nothing
End Sub

'Delete a registry key

Sub Main()
Dim RegObj
Set RegObj = CreateObject("WScript.Shell")
RegObj.RegDelete("REGISTRY_KEY_TO_DELETE")
Set RegObj = Nothing
End Sub

'Easy huh? ;-)

Download this snippet    Add to My Saved Code

Functions to read/write/delete a registry key (Very small code + No API's!) Comments

No comments have been posted about Functions to read/write/delete a registry key (Very small code + No API's!). Why not be the first to post a comment about Functions to read/write/delete a registry key (Very small code + No API's!).

Post your comment

Subject:
Message:
0/1000 characters