Delphi 控件ComboBox的问题
来源:百度知道 编辑:UC知道 时间:2024/05/25 20:54:44
其实主要就是个遍历文件夹操作。
{-------------------------------------------------------------------------------
过程名: MakeFileList 遍历文件夹及子文件夹
参数: Path,FileExt:string 1.需要遍历的目录 2.要遍历的文件扩展名
返回值: TStringList
Eg:ListBox1.Items:= MakeFileList( 'E:\指定的文件路径','.exe') ;
ListBox1.Items:= MakeFileList( 'D:\指定的文件路径','.*') ;
-------------------------------------------------------------------------------}
function MakeFileList(Path,FileExt:string):TStringList ;
var
sch:TSearchrec;
begin
Result:=TStringlist.Create;
if rightStr(trim(Path), 1) <> '\' then
Path := trim(Path) + '\'
else
Path := trim(Path);
if not DirectoryExists(Path) then
begin
Result.Clear;
exit;
end;
if FindFirst(Path + '*', faAnyfile, sch) = 0 then
begin
repeat
Application.P