Pascal Scripting: RegGetSubkeyNames

Prototype:

function RegGetSubkeyNames(const RootKey: Integer; const SubKeyName: String; var Names: TArrayOfString): Boolean;

Description:

Opens the specified registry key and reads the names of its subkeys into the specified string array Names. Returns True if successful, False otherwise.

Example:
var
  Names: TArrayOfString;
  I: Integer;
  S: String;
begin
  if RegGetSubkeyNames(HKEY_CURRENT_USER, 'Control Panel', Names) then
  begin
    S := '';
    for I := 0 to GetArrayLength(Names)-1 do
      S := S + Names[I] + #13#10;
    MsgBox('List of subkeys:'#13#10#13#10 + S, mbInformation, MB_OK);
  end else
  begin
    // add any code to handle failure here
  end;
end;