enumKeys

enumKeys

Enumerates the registry subkeys for the given key.

Method of

WinReg object

Syntax

String enumKeys ( String key, int subkeyIndex );

Parameters

The enumKeys method has the following parameters:

key
The key path to the appropriate location in the key hierarchy, such as "Software\\Netscape\\Navigator\\Mail".
subkeyIndex
An integer representing the 0-based index of the subkey being sought.

Returns

The name if it succeeded; NULL if the referenced value does not exist.

Description

enumKeys can be used to iterate through the subkeys at a given key location. The following example shows how to use enumKeys to find the plugins subdirectory below the various Mozilla-based browser installations.

var winreg = getWinRegistry();
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
var index = 0;
var baseKey = "Software\\Mozilla";
while ( (MozillaVersion = winreg.enumKeys(baseKey,index)) != null )
{
  logComment("MozillaVersion = " + MozillaVersion);
  subkey = baseKey + "\\" + MozillaVersion + "\\Extensions";
  pluginsDir = winreg.getValueString ( subkey, "Plugins" );
  if ( pluginsDir )
    logComment("pluginsDir = " +  pluginsDir);
  else
    logComment("No plugins dir for " + baseKey + "\\" + MozillaVersion);
  index++;
}

Document Tags and Contributors

 Last updated by: Sheppy,