RegistryItem
From Xojo Documentation
This class is only available on the Windows platform. For cross-platform compatibility, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this class on an incompatible platform. |
Creates and manages registry items on Windows.
Properties | ||||
|
Methods | ||||||||
|
Constructors | ||
|
Notes
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:
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:
Var reg As New RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", False)
Var lines() As String
// now we look on all values on this key
For i As Integer = 0 To reg.KeyCount - 1
Var name As String = reg.Name(i)
Var value As Variant = reg.Value(i)
lines.Add(name + " -> " + value)
Next
// and display them
Var s As String
s.Join(lines, EndOfLine)
MessageBox(s)
See Also
RegistryAccessErrorException error.