Aus der JCL:
Delphi-Quellcode:
function BuildFileList(const Path: string; const Attr: Integer; const List: TStrings): Boolean;
var
SearchRec: TSearchRec;
R: Integer;
begin
Assert(List <> nil);
R := FindFirst(Path, Attr, SearchRec);
Result := R = 0;
List.BeginUpdate;
try
if Result then
begin
while R = 0 do
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
List.Add(SearchRec.Name);
R := FindNext(SearchRec);
end;
Result := R = ERROR_NO_MORE_FILES;
end;
finally
SysUtils.FindClose(SearchRec);
List.EndUpdate;
end;
end;
// Aufruf
BuidlFileList('C:\Windows\*.exe', faAnyFile, Memo1.Lines);
Meine Empfehlung: Installier die
JCL (
http://sourceforge.net/project/showf...group_id=47514 ),
da gibts noch viel mehr zu entdecken.