1、将filectrl.pas另存为相同文件名,保存在自己程序源文件的目录下
2、将filectrl.pas时的下面函数作如下修改:
function TDirectoryListbox.ReadDirectoryNames(const ParentDirectory: string;
DirectoryList: TStringList): Integer;
var
Status: Integer;
SearchRec: TSearchRec;
begin
Result := 0;
{ 修改下面一行的faDirectory为faAnyFile }
Status := FindFirst(SlashSep(ParentDirectory, '*.*'), faDirectory, SearchRec);
//Status := FindFirst(SlashSep(ParentDirectory, '*.*'), faAnyFile, SearchRec);
try
while Status = 0 do
begin
if (SearchRec.Attr and faDirectory = faDirectory) then
begin
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
begin
DirectoryList.Add(SearchRec.Name);
Inc(Result);
end;
end;
Status := FindNext(SearchRec);
end;
finally
FindClose(SearchRec);
end;
end;