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

From Xojo Documentation

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

New in 2005r1

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:

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

Create a new Registry key (Administer privileges required):

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