【发布时间】:2014-12-20 12:37:05
【问题描述】:
如何列出 ListBox 中的所有 Dir 文件? 我在 Windows 中尝试了这段代码,它可以工作,但它在 Android 中不起作用。
procedure ListFileDir(Path: string; FileList: TStrings);
var
SR: TSearchRec;
begin
if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
begin
repeat
if (SR.Attr <> faDirectory) then
begin
FileList.Add(SR.Name);
end;
until FindNext(SR) <> 0;
FindClose(SR);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListFileDir('sdcard/1/', ListBox1.Items);
end;
【问题讨论】: