function RegGetSubkeyNames(const RootKey: Integer; const SubKeyName: String; var Names: TArrayOfString): Boolean;
Opens the specified registry key and reads the names of its subkeys into the specified string array Names. Returns True if successful, False otherwise.
var Names: TArrayOfString; S: String; begin if RegGetSubkeyNames(HKEY_CURRENT_USER, 'Control Panel', Names) then begin S := StringJoin(#13#10, Names); MsgBox('List of subkeys:'#13#10#13#10 + S, mbInformation, MB_OK); end else begin // add any code to handle failure here end; end;