Delphi-Quellcode:
OpenDialog1.Filter := *.PAS;*.DPK;*.DPR';
OpenDialog1.Filter := *.wav;*.mdi;*.mp3';
so wäre das top. Aber ich benutze keinen dialog dafür. mit dem Semikolon abzutrennen habe ich schon versucht, das klappt aber nicht.
hier die procedure in der ich die masken übergeben will:
Delphi-Quellcode:
procedure GetFilesInDirectory(Directory: String; const Mask: String;
List: TStrings;
WithSubDirs, ClearList: Boolean);
implementation
procedure GetFilesInDirectory(Directory: String; const Mask: String;
List: TStrings;
WithSubDirs, ClearList: Boolean);
procedure ScanDir(const Directory: String);
var SR: TSearchRec;
begin
if FindFirst(Directory + Mask, faAnyFile - faDirectory, SR) = 0 then
try
repeat List.Add(ExtractFileName(Directory + SR.Name))
until FindNext(SR) <> 0;
finally FindClose(SR);
end;
if WithSubDirs then
begin
if FindFirst(Directory + '*.*', faAnyFile, SR) = 0 then
try
repeat
if ((SR.attr and faDirectory) = faDirectory) and
(SR.Name <> '.') and (SR.Name <> '..') then
ScanDir(Directory + SR.Name + '\');
until FindNext(SR) <> 0;
finally FindClose(SR);
end;
end;
end;
begin List.BeginUpdate;
try
if ClearList then
List.Clear;
if Directory = ''
then Exit;
if Directory[Length(Directory)] <> '\'
then Directory := Directory + '\';
ScanDir(Directory);
finally
List.EndUpdate;
end;
end;
end.