提示[Error] PSInserT.pas(66): Undeclared identifier: 'GetAllFileName'

nww2002 2020-11-09 03:59:59
procedure Tfrmpict.BitBtn2Click(Sender: TObject);
var
dirlist:TStringList;
i:Integer;
begin
inherited;
if chk_road.Checked then
begin
dirlist:=TStringList.Create ;
dirlist.Clear;
try
GetAllFileName(DirectoryListBox1.Directory,dirlist);
if dirlist.Count>0 then
begin
Gauge1.MinValue :=0;
Gauge1.MaxValue:= dirlist.Count-1;
for i:=0 to dirlist.Count-1 do
begin
with ADOQuery1 do
begin
Insert;
Fields[0].AsString:=copy(dirlist.Strings[i],1,pos('.',dirlist.Strings[i])-1);
if imagesavetosql(ADOQuery1,dirlist.Strings[i] )=false then
begin
ShowMessage('导入'+dirlist.Strings[i]+'.jpg图片时出错');
Abort;
end;
Post;
end; //with
Gauge1.AddProgress(1);
end; //for
end //if
else
ShowMessage('该目录下不存在JPG类型图片');

finally
dirlist.Free;
end;

end
else
ShowMessage('请执行路径选取操作');

//Close;
end;

提示:[Error] PSInserT.pas(66): Undeclared identifier: 'GetAllFileName',要如何处理?
...全文
140 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nww2002 2020-11-17
  • 打赏
  • 举报
回复
Procedure GetAllFileName(const fpath: String; filelist: TstringList); var fs: TsearchRec; begin if findfirst(fpath+'/*.jpg',faAnyFile,fs)<>0 then exit; repeat if (fs.name<>'.') and (fs.name<>'..') then if((fs.Attr and faDirectory)=faDirectory) then GetAllFileName(fpath+'/'+fs.Name,filelist) else filelist.Add(fpath+'/'+fs.name); until findnext(fs)<>0 ; sysutils.findclose(fs); end;
天行归来 2020-11-09
  • 打赏
  • 举报
回复
提示输出已经说很明白了,未定义 GetAllFileName 函数,引用 GetAllFileName 对应单元就可以。 貌似IDE没有提供这个函数,所以应该是自定义的函数,如果是自定义函数,引用这个函数所在单元就可以。
tanqth 2020-11-09
  • 打赏
  • 举报
回复
你这段代码,多半是云抄的,而且你应该没抄全,少抄了一个函数GetAllFileName。

5,939

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧