Hallo,
ich habe ein Programm geschrieben, das mit FirstFind Dateien finden soll. Mir ist gestern beim Ausprobieren aufgefallen, dass das Programm keine Dateien findet, die - wenn man unter Windows in den Eigenschaften der Dateien schaut - nicht als "Archiv" markiert sind, auch wenn die Sucheigenschaft auf "faAnyFile" steht.
Hier mal ein Auszug aus dem Quellcode:
Code:
procedure TForm1.BitBtn2Click(Sender: TObject);
var
sr: TSearchRec;
FileAttrs, i, i0, Zeile: Integer;
begin
StringGrid1.RowCount := 5;
Zeile := 0;
if CheckBox1.Checked then
FileAttrs := faReadOnly
else
FileAttrs := 0;
if CheckBox2.Checked then
FileAttrs := FileAttrs + faHidden;
if CheckBox3.Checked then
FileAttrs := FileAttrs + faSysFile;
if CheckBox4.Checked then
FileAttrs := FileAttrs + faVolumeID;
if CheckBox5.Checked then
FileAttrs := FileAttrs + faDirectory;
if CheckBox6.Checked then
FileAttrs := FileAttrs + faArchive;
if CheckBox7.Checked then
FileAttrs := FileAttrs + faAnyFile;
For i := 1 to Memo1.Lines.Count+1 do
begin
with StringGrid1 do
begin
if FindFirst(Edit1.Text + '\' + Memo1.Lines[i-1], FileAttrs, sr) = 0 then
begin
repeat
if (sr.Attr and FileAttrs) = sr.Attr then
begin
If Zeile >= 4 then
begin
StringGrid1.ColWidths[2] := 82;
RowCount := RowCount + 1;
end;
Inc(Zeile);
Cells[0,Zeile] := sr.Name;
Cells[1,Zeile] := Format('%.0f KB',[sr.Size / 1000]);
begin
If sr.Attr = 1 then
Cells[2,Zeile] := 'schreibgeschützt';
If sr.Attr = 2 then
Cells[2,Zeile] := 'versteckt';
If sr.Attr = 4 then
Cells[2,Zeile] := 'Systemdatei';
If sr.Attr = 8 then
Cells[2,Zeile] := 'Laufwerks-ID';
If sr.Attr = 16 then
Cells[2,Zeile] := 'Verzeichnis';
If sr.Attr = 32 then
Cells[2,Zeile] := 'Archivdatei';
If sr.Attr = 64 then
Cells[2,Zeile] := 'Verknüpfung';
end;
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
end;
end;
Was bedeutet das es eigentlich, wenn eine Datei als "Archiv" deklariert ist???
Gruß Eric