Есть процедура поиска:
- Код: Выделить всё
procedure Tfc1.Find(FindPatch: string);
var Res: TSearchRec; //Рез-т поиска
FindRes: Integer;
FindPatch1: string;
begin
FindPatch := FindPatch + '\\';
FindPatch1 := FindPatch;
FindRes := FindFirst(FindPatch+'*.*', faAnyFile, Res);
while FindRes = 0 do
begin
if ((Res.Attr{ and faDirectory}) = faDirectory) and ((Res.Name = '.') or (Res.Name = '..')) then
begin
FindRes := FindNext(Res);
Continue;
end;
if ((Res.Attr{ and faDirectory}) = faDirectory) then
begin
Find(FindPatch + Res.Name{ + '\\'});
FindPatch1 := FindPatch + Res.Name{ + '\\'};
FindRes := FindNext(Res);
Continue;
end;
FileList1.RowCount := FileList1.RowCount+1;
FileList1.Cells[0, FileList1.RowCount-1] := AnsiToUTF8(Res.Name);
FileList1.Cells[1, FileList1.RowCount-1] := AnsiToUTF8(FindPatch1);
inc(kDir);
Label2.Caption:='Найдено объектов: ' + IntToStr(kDir);
FindRes := FindNext(Res);
end;
FindClose(Res);
end;
со стандартным разделом uses всё проходит хорошо.
Но стоит добавить модуль Windows, как ругается на FindClose(Res):
Incompatible types for aeg no. 1: Got "TSearchRec", expected "LongWord"