From Xojo Documentation

Class (inherits from Object)

Creates and manages registry items on Windows.

FolderCount fa-lock-32.png Parent fa-lock-32.png
KeyCount fa-lock-32.png Path fa-lock-32.png
AddFolder Item
Child KeyType
DefaultValue Name
Delete Value

RegistryItem.Constructor(copy as RegistryItem)

RegistryItem.Constructor(path as String , create as Boolean)


The Value method returns valid information for expandable strings, binary and multi-strings. In the case of expandable strings, the string is automatically expands for you and returns it as a string. It supports getting and setting 64-bit values. The default value may also be 64-bit.

In the case of multi-strings, you are passed back a string that is Chr(0)-delimited. You can use the Split function to get the individual parts, like this:

part = Split(regValue, Chr(0))

where part is a String array.

In the case of a binary value, a MemoryBlock is returned. You cannot currently set an expandable string, or a multistring. To set a binary string, please pass in a MemoryBlock.

Sample Code

This code displays the registry entries for the current Windows version:

// Get a registry key
Dim reg As New RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", False)

Dim lines() As String

// now we look on all values on this key
For i As Integer = 0 To reg.KeyCount - 1
Dim name As String = reg.Name(i)
Dim value As Variant = reg.Value(i)
lines.Append(name + " -> " + value)

// and display them
MsgBox(Join(lines, EndOfLine))

See Also

RegistryAccessErrorException error.