Provides access to the system registry. The object is designed to
represent a "current key". I.e. you can think of the
Registry object as attached to the registry key specified by the Key
and Path properties. When you work with values the Name property
"attaches" the object to the desired value.
The object allows enumeration of registry keys, but this features
are is not
implemented as collections that can be enumerated with For Each
statements. The reasons are two - compatibility with the previous
version of this object and the fact that the sub-keys enumerated can
be too many. Depending on the usage this may lead to allocation of
huge amount of system resources for a simple operation. See
GetPathName and GetValueName for more information on how to
enumerate keys and values.
| Name |
Syntax |
Description |
Key |
object.Key = value
variable = object.Key |
Sets the registry branch. Common constants:
Const HKEY_CLASSES_ROOT = &H0
Const HKEY_CURRENT_USER = &H1
Const HKEY_LOCAL_MACHINE = &H2
Const HKEY_USERS = &H3
Const HKEY_PERFORMANCE_DATA = &H4
Const HKEY_CURRENT_CONFIG = &H5
Const HKEY_DYN_DATA = &H6
|
Path |
object.Path = value
variable = object.Path |
Sets/gets the key path name |
Value |
object.Value = value
variable = object.Value |
Sets/gets the value for the
value with the specified Name (see Name).
Default property. |
Name |
object.Name = value
variable = object.Name |
Specifies the name of the
current value in the current key. |
Version |
variable =
object.Version |
Returns the object version |
ValueType |
object.ValueType =
value
variable = object.ValueType |
Specifies the type of the
registry value type. When a value is assigned to the Value
property it is converted internally to this type. Common
constants:
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_DWORD_LITTLE_ENDIAN = 4
Const REG_DWORD_BIG_ENDIAN = 5
Const REG_LINK = 6
Const REG_MULTI_SZ = 7
|
GetPathName |
enum_path =
object.GetPathName(nKey) |
Call with nKey = 0 and then
increment nKey to enumerate the sub-keys in the current key.
When there are no more keys an error will occur. If you do not
want On Error statements an empty key name will be returned if
you set the ReturnEmptyForEnumEnd to true. |
GetValueName |
enum_val =
object.GetPathName(nVal) |
Call with nVal = 0 and then
increment nVal to enumerate the values in the current key.
When there are no more values an error will occur. If you do
not want On Error statements an empty key name will be
returned if you set the ReturnEmptyForEnumEnd to true. |
CreatePath |
object..CreatePath() |
Creates a registry key
specified by the Path property with the in the registry branch
specified by the Key property. |
DeletePath |
object.DeletePath |
Deletes the registry key
specified by the Path property with the in the registry branch
specified by the Key property. |
DeleteValue |
object.DeleteValue |
Deletes the value specified
by the Name property from the current key (the key is
determined by the Key and the Path properties). |
| Advanced
features |
UseRawBinary |
object.UseRawBinary =
bool_val
variable = object.UseRawBinary |
Default is false.
If set to true the Value property will return binary data
instead of hex decimal textual representation of binary data
for binary (REG_BINARY) values. Useful when you want to pass
the data to a database or another object that requires binary
data (VT_ARRAY | VT_UI1). |
HexWithSpaces |
object.HexWithSpaces =
bool_val
variable = object.HexWithSpaces |
Default is false.
When the Value property returns the value of a binary value (REG_BINARY),
by default it returns is as hex-decimal string. Id this
property is set to true spaces between the bytes will be
inserted. |
ReturnEmptyForEnumEnd |
object.ReturnEmptyForEnumEnd
= bool_val
variable = object.ReturnEmptyForEnumEnd |
Default is false.
GetPathName and GetValueName by default generate an error
which can be intercepted with OnError statement when there are
no more keys/values to enumerate. Setting this property to
true changes this behavior and they return empty strings
instead of generating an error. |