VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Read, Write & Delete ANYWHERE in the registry, with ONE LINE of code THE BEST REGISTRY CODE ON HERE

by Chris Wilson (9 Submissions)
Category: Registry
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 4th November 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Read, Write & Delete ANYWHERE in the registry, with ONE LINE of code THE BEST REGISTRY CODE ON HERE

API Declarations



Public Sub CreateKey(Folder As String, Value As String)

Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value

End Sub

Public Sub CreateIntegerKey(Folder As String, Value As Integer)

Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
b.RegWrite Folder, Value, "REG_DWORD"


End Sub

Public Function ReadKey(Value As String) As String

'READ FROM WINDOWS REGISTRY
'.........................
Dim b As Object
On Error Resume Next
Set b = CreateObject("wscript.shell")
r = b.RegRead(Value)
ReadKey = r
End Function


Public Sub DeleteKey(Value As String)
'DELETE VALUES FROM WINDOWS REGISTRY
'-----------------------------------
Dim b As Object
On Error Resume Next
Set b = CreateObject("Wscript.Shell")
b.RegDelete Value
End Sub

Rate Read, Write & Delete ANYWHERE in the registry, with ONE LINE of code THE BEST REGISTRY CODE ON HERE



CreateKey "HKEY_CURRENT_USER\Software\My Software\Version","1.45"

'To Create an Integer registry key:
CreateIntegerKey "HKEY_CURRENT_USER\Software\My Software\Number","50"

'To Read from the registry
msgbox "Version is " & ReadKey("HKEY_CURRENT_USER\Software\My Software\Version"

'To Delete from the registry
DeleteKey "HKEY_CURRENT_USER\Software\My Software\Version"

' Thats it.. easy :)
' Instead of writing out HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER etc, you can
' use abbreviations such as "HKCU\Software"

' If you need help, email [email protected] or add me into ure MSN
' Messenger friends list

Download this snippet    Add to My Saved Code

Read, Write & Delete ANYWHERE in the registry, with ONE LINE of code THE BEST REGISTRY CODE ON HERE Comments

No comments have been posted about Read, Write & Delete ANYWHERE in the registry, with ONE LINE of code THE BEST REGISTRY CODE ON HERE. Why not be the first to post a comment about Read, Write & Delete ANYWHERE in the registry, with ONE LINE of code THE BEST REGISTRY CODE ON HERE.

Post your comment

Subject:
Message:
0/1000 characters