What's special about this syntax is the DeleteSubKeys parameter, which takes a Boolean value. When you specify True, DeleteKey recursively deletes any subkeys of the specified key before attempting to delete the key itself. When you specify False, DeleteKey behaves the same way as the StdRegProv DeleteKey method. If the DeleteSubKeys parameter is True but an error occurs when trying to delete a subkey, DeleteKey will simply exit with the last relevant exit code. The DeleteKey method returns a zero when it succeeds or a nonzero value when it fails.
DeleteValue. To delete a registry value, you use the DeleteValue method. DeleteValue follows the syntax
DeleteValue(DefKey, SubKeyName, ValueName)
where ValueName is the name of the value you want to manipulate (in this case, delete). The method returns a zero when it succeeds or a nonzero value when it fails.
EnumKey. The EnumKey method populates the g_EnumDict object with the subkeys in a registry key. You specify the target key by following the syntax
EnumKey(DefKey, SubKeyName)
To access the g_EnumDict object, you use the EnumDict property, which Table 1 describes. The g_EnumDict object's keys will contain the registry subkey names; the Dictionary object's values will be empty strings. EnumKey returns a zero when it succeeds or a nonzero value when it fails.
EnumValues. The Penton.RegObject object's EnumValues method uses the StdRegProv object's EnumValues method to populate the g_EnumDict object with the specified registry subkey's values and data types. The method follows the syntax
EnumValues(DefKey,SubKeyName)
You can use the EnumDict property to access the g_EnumDict object. This object's key/value pairs will contain the values and corresponding data types (e.g., REG_SZ, REG_DWORD). EnumValues returns a zero when it succeeds or a nonzero value when it fails.
EnumValuesAndData. The EnumValuesAndData method is the same as the EnumValues method, except that the values in the g_EnumDict object's key/value pairs contain the contents of the registry values rather than the values' data types. The EnumValuesAndData method uses the syntax
EnumValuesAndData(DefKey,SubKeyName)
EnumValuesAndData works by first calling the StdRegProv object's EnumValues method, then iterates through the returned array of values. For each value, EnumValuesAndData retrieves the content by calling the corresponding StdRegProv Get<xxx>Value method, where <xxx> is that value's data type. For example, if the value is type Binary, EnumValuesAndData calls the GetBinaryValue method.
EnumValuesAndData adds the
values' contents to the g_RegResult Dictionary object. However, the StdRegProv object's GetBinaryValue and GetMultiStringValue methods return arrays, so EnumValuesAndData converts those arrays to strings before adding the contents to g_RegResult. Note that REG_BINARY values are represented as a series of hexadecimal digits and the strings in a REG_MULTI_SZ value are delimited by pipe (|) characters.
ExistKey. You use the ExistKey method to determine whether a registry key exists. This method uses the syntax
ExistKey(DefKey, SubKeyName, KeyName)
where KeyName is the name of the key you're checking for. This method iterates through the subkeys in the specified key using the StdRegProv object's EnumKey method, which returns an array of subkey names. The Penton.RegObject object's ExistKey method compares each subkey name in the array with the name specified in the KeyName parameter. If a match occurs, ExistKey returns True; otherwise, it returns False.
ExistValue. You use the ExistValue method to determine whether a certain value exists in a registry key. This method follows the syntax
ExistValue(DefKey, SubKeyName,ValueName)
ExistValue iterates through the values in the specified subkey using the StdRegProv object's EnumValues method, which returns an array of value names. ExistValue compares each value name in the array with the name specified in the ValueName parameter. If a match occurs, ExistValue returns True; otherwise, it returns False.
ReadValue. The ReadValue method reads a registry value and its data type. ReadValue uses the syntax
ReadValue(DefKey, SubKeyName,ValueName)
ReadValue iterates through the values in the specified subkey using the StdRegProv object's EnumValues method, which returns an array containing the value names and data types. ReadValue compares each value name in the array with the name specified in the ValueName parameter. If a match occurs, ReadValue calls the appropriate StdRegProv Get<xxx>Value method. When the Get<xxx>
Value method succeeds, a zero is returned. The Penton.RegObject object's Result and ValueType properties, in turn, will contain the registry value's data and data type as a string (e.g., "REG_DWORD"), respectively. When the Get<xxx>Value method fails, a nonzero value is returned. The Result property won't be changed, but the ValueType property will contain Null.
WriteValue. The WriteValue method writes data to the registry. It uses the syntax
WriteValue(DefKey, SubKeyName, ValueName, ValueType, RegData)
where ValueType is the type of value you want to write. You can specify one of the following values: REG_SZ, REG_EXPAND_SZ, REG_BINARY, REG_DWORD, or REG_MULTI_SZ. For the RegData parameter, you specify the value's data.
The WriteValue method calls the StdRegProv object's Set<xxx>Value method, where <xxx> is the type of value that corresponds to the RegData parameter. For example, if the RegData parameter specifies REG_SZ, WriteValue calls the StdRegProv SetStringValue method. If you specify REG_BINARY or REG_MULTI_SZ, the RegData parameter should contain an array of bytes or strings, respectively. WriteValue returns a zero when it succeeds or a nonzero value when it fails.
toVBArray. The toVBArray method provides a JScript script the ability to convert a JScript array into a VB safe array. This method is useful when you need to create a new VBArray object from a JScript array. For example, you can create a JScript array containing the data for a REG_BINARY value and use the toVBArray method to convert it to a VBArray object as input for the WriteValue method.
The toVBArray method uses the syntax
toVBArray(JSArray)
where JSArray contains a JScript array. The JScript array must contain numeric subscripts that start with zero and are contiguous (e.g., subscripts of 0, 1, and 3 wouldn't work, but 0, 1, and 2 would work).
Prev. page
1
[2]
3
next page