Valid on Windows
The RegENumVariable function enumerates the variables for the specified registry key.
Function format:
RegEnumVariable(hKey as Integer, index as Integer, name as String, strvalue as String, intvalue as Integer) as Integer
RegEnumVariable(hkey as integer, index as integer, dummy as string, name as string, bufsize as integer, buffer as void) as integer.
Identifies a currently open key or a predefined key. The hKey parameter can have one of the following predefined values available on all Windows platforms:
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Identifies the index of the variable that is to be retrieved. Use zero for the first call of the function.
Identifies the output parameter that is to hold the name of the requested variable.
Identifies the output parameter that is to hold the string value of the requested variable.
Identifies the output parameter that is to hold the integer value of the requested variable.
Reserved.
Size of the receiving buffer in chars if the buffer is of type string; otherwise, the number of bytes are specified. Must be a variable. After a successful return, it contains the number of bytes retrieved.
Buffer to receive the retrieved value of the variable.
On successful completion, the first variant of the function returns one of the following values:
Value 0; A variable was not found. This indicates that either the last index of the enumeration has been reached or the handle was invalid.
Value 1; An Integer type variable was found; the value will be stored in the intvalue variable.
Value 2; A String type variable was found; the value will be stored in the strvalue variable.
Value 3; An unsupported variable type was found; the value will be void.
The second variant of the function returns in Microsoft notation:
Value 0
Value 1
Value 2
Value 3
Value 4
Value 4
Value 5
Value 6
Value 7
Example:
Dim value as string
Dim hkey1 as integer
Dim name, str, dummy as string
Dim i, i1, rtr, int as integer
Dim bBuf[100] as Byte
Dim cBuf[100] as char
ClrScr()
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\CA")
if hkey1 = 0 then
Print("RegOpenKey failed.")
exit
endif
i = 0
while
RegEnumKey(hkey1, i, str)
Print(Str(i) + " - " + str)
RegCloseKey(hkey1)
Print " "
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\CA\4 test only")
if hkey1 = 0 then
Print("RegOpenKey failed.")
exit
endif
for i = 0 to 1
rtr = RegEnumVariable(hKey1, i, name, str, i1)
if (REG_INTEGER = rtr) then
Print(Str(rtr) + ": " + Str(i) + " - " + name + " = " + Str(i1))
else
if (REG_STRING = rtr) then
Print(Str(rtr) + ": " + Str(i) + " - " + name + " = " + str)
else
Print(Str(rtr) + ": " + "unknown type");
endif
endif
next i
i1 = 100
str = ""
rtr = RegEnumVariable(hKey1, 2, name, dummy, i1, bBuf))
for i = 0 to i1 - 1
str = str + Str(bBuf[i])
next i
Print (Str(rtr) + ": " + "2 - " + name + "(" + Str(i1) + ") = " + str)
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|