Previous Topic: RegDeleteVariable - Remove a VariableNext Topic: RegEnumVariable - Enumerate the Variables


RegEnumKey - Enumerate the Subkeys of a Registry Key

Valid on Windows

The RegEnumKey function enumerates the subkeys of a specified registry key.

Function format:

RegEnumKey(hKey as Integer, index as Integer, subkey as String) as Boolean
hKey

Identifies a currently open key or a predefined key. The hKey parameter can have one of the following predefined values:

HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
index

Identifies the index of the subkey that is to be retrieved. Use zero for the first call of the function.

subkey

Identifies the output parameter that is to hold the requested subkey.

On successful completion, the function returns TRUE and fills in the name of the subkey in the subkey variable. If the key is invalid or there are no more subkeys, it returns FALSE.

Example:

Presupposed registry structure:

HKLM

Software

CA

test-1

...

test-9

dummy

4test only

var-0 "test 2"

...


Rem
Rem This example enumerates the subkeys of HKEY_CLASSES_ROOT,
Rem printing all filetype entries.
Rem

Dim SubKey as string
Dim Index as integer

Index=0
while RegEnumKey(HKEY_CLASSES_ROOT,Index,SubKey)
	 if Left(SubKey,1)="." then print SubKey
	 Index=Index+1
wend