Name
OpenRegistryKey -- open registry key for iteration (V11.0)
Synopsis
[id] = OpenRegistryKey(id, base, key$)
Library
windows

Platforms
Microsoft Windows only

Function
This function opens the registry key specified by base and key$ and assigns the specified id to it. If you pass Nil in id, OpenRegistryKey() will automatically choose an identifier and return it. After you have opened the registry key, you can then iterate over all of its entries using the NextRegistryKeyEntry() function. Once you are done with the iteration, call CloseRegistryKey() to close the registry key again.

The key$ argument specifies the registry key that you want to open and the base argument must be used to specify the base registry tree. It can be one of the following constants:

 
#HKEY_CLASSES_ROOT
#HKEY_CURRENT_CONFIG
#HKEY_LOCAL_MACHINE
#HKEY_USERS
#HKEY_CURRENT_USER

Inputs
id
id for the registry key or Nil for auto id selection
base
one of the base tree constants from above
key$
the registry key to open
Results
id
optional: identifier of the registry key; will only be returned when you pass Nil as argument 1 (see above)
Example
OpenRegistryKey(1, #HKEY_CURRENT_USER, "SOFTWARE/Microsoft")
v$, type = NextRegistryKeyEntry(1)
While v$ <> ""
    DebugPrint(v$, type)
    v$, type = NextRegistryKeyEntry(1)
Wend
CloseRegistryKey(1)
The code above prints all entries in the "SOFTWARE/Microsoft" registry entry in HKEY_CURRENT_USER.

Show TOC