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

From Xojo Documentation

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

Creates or reads the registry item from the path passed to it.

Notes

The optional parameter create defaults to True; if you set it to False, the path will not be created if the path is not found. A RegistryAccessErrorException occurs when the path is not found (when create is False) or if you do not have permission to create the path (when create is True).

In order to create Registry keys, your app needs to be running with Administrator privileges.

On 64-bit Windows, registry keys for "HKEY_LOCAL_MACHINE\SOFTWARE" may instead be created in the "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node" folder. Refer to the Microsoft document "32-bit and 64-bit Application Data in the Registry" for additional information about this.

Example

Get the Windows product name from the Registry:

Dim reg As New RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", False)
MsgBox(reg.Value("ProductName")) // Shows Windows product name

Create a new Registry key (Administer privileges required):

Dim reg As New RegistryItem("HKEY_LOCAL_MACHINE\SOFTWARE\ACME")
reg = reg.AddFolder("MyApp")
reg.Value("Version") = 1.0