GetFirstValue

GetFirstValue is a function whose purpose is to initiate the enumeration of a registry path.

Syntax

GetFirstValue(Path, ValueName)

Returns
  • Long - if registry value is REG_DWORD
  • String - if registry value is REG_SZ
  • Array of Strings - If registry value is REG_MULTI_SZ
  • Array of bytes - if registry value is REG_BINARY
More Information

ValueName must be a variable of type variant. GetFirstValue will return the name of the attribute which contains the value returned inside the variable ValueName.

Example

This scripts lists all of the programs that run on startup:

Function Main

Dim Ro As Object

Dim valueName as variant

cr = Chr(13) + Chr(10)

Set Ro = Registry.Connect("127.0.0.1")

Value = ro.GetFirstValue("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", valueName)

While Value <> ""

Echo "ValueName: " & valueName & " = " & value & cr

Value = ro.GetNextValue(valueName)

Wend

End Function