procedure TForm1.RzBitBtn1Click(Sender: TObject);
var
searchrec: TSearchrec; //*********************************
path, FileName: string; //最简单的使用(文件) 查找
findresult: integer; //只能搜索指定目录(不包含子文件夹)
arr: array[0..MAX_PATH] of Char;
num: DWORD;
begin
Memo1.Clear;
num := GetWindowsDirectory(arr, MAX_PATH);
path := arr + '\';
findresult := findfirst(path + '*.*', faanyfile + fahidden + fasysfile + fareadonly, searchrec);
while findresult = 0 do
begin
Memo1.Lines.Add(lowercase(path + searchrec.Name));
findresult := findnext(searchrec);
end;
end;
转载于:https://www.cnblogs.com/bingege/archive/2010/04/13/1710984.html