Might be worth noting the help text for FindFirst, put cursor on the FindFirst statement and press F1.
It warns you against assuming that setting attr to (eg) faDirectory will get only directories back. You get back ordinary files AND, in this case directories.
So, Jorg3000 code might need to look a bit like this (untested) -
...
if FindFirst(AppendPathDelim(APath) + '*',faDirectory, SR) = 0 then begin
try
repeat
if ((SR.Attr and faDirectory) = faDirectory) and (ST>Name <> '.') and (SR.Name <> '..') then
SL.Add(SR.Name);
until FindNext(Info) <> 0;
finally
FindClose(Info);
end;
end;
The TSearchRecord does not need to be initialized or filled in, that happens in FindFirst.
On the other hand, creating the the stringlist up in the calling function as shown is really good. Creating in a function and then passing it back up stream is very bad practice that will, sooner or later lead to a memory leak.
edit:typo
Davo