procedure TForm1.Mod_btnClick(Sender: TObject);
var
Directory: string;
WorkPath: String;
SearchRec: TSearchRec;
i:integer;
begin
Mod_LBx.Visible:=true;
WorkPath := ExtractFilePath(Application.ExeName);
if WorkPath[Length(WorkPath)] <> '\' then WorkPath := WorkPath + '\';
Directory:=WorkPath+'模板\';
if DirectoryExists(Directory) then
if FindFirst(Directory,faDirectory,SearchRec) = 0 then
while FindNext(SearchRec) = 0 do
begin
if (SearchRec.Attr and faAnyFile)<>0 then //任何文件
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') and (GetFileExpName(UpperCase(SearchRec.Name))<>'模板') then
begin
Mod_LBx.Items.Add(SearchRec.Name);
end;
end;
FindClose(SearchRec);
end; procedure TForm1.GetFileExpName(FileName: ShortString);
var DotPos: Integer;
begin
DotPos := Pos('.',FileName);
if DotPos>0 then
Result := UpperCase(Copy(FileName,DotPos+1,Length(FileName)-DotPos));
end; procedure TForm1.ModCBtnClick(Sender: TObject);
begin
Mod_LBx.Visible:=false;
end;
var
Directory: string;
WorkPath: String;
SearchRec: TSearchRec;
i:integer;
begin
Mod_LBx.Visible:=true;
WorkPath := ExtractFilePath(Application.ExeName);
if WorkPath[Length(WorkPath)] <> '\' then WorkPath := WorkPath + '\';
Directory:=WorkPath+'模板\';
if DirectoryExists(Directory) then
if FindFirst(Directory,faDirectory,SearchRec) = 0 then
while FindNext(SearchRec) = 0 do
begin
if (SearchRec.Attr and faAnyFile)<>0 then //任何文件
if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') and (GetFileExpName(UpperCase(SearchRec.Name))<>'模板') then
begin
Mod_LBx.Items.Add(SearchRec.Name);
end;
end;
FindClose(SearchRec);
end; procedure TForm1.GetFileExpName(FileName: ShortString);
var DotPos: Integer;
begin
DotPos := Pos('.',FileName);
if DotPos>0 then
Result := UpperCase(Copy(FileName,DotPos+1,Length(FileName)-DotPos));
end; procedure TForm1.ModCBtnClick(Sender: TObject);
begin
Mod_LBx.Visible:=false;
end;
解决方案 »
- 怎样在硬盘上创建一个空目录?
- 谁能帮我解决一下delphi对sql2000数据库数据备份和数据还原的问题。
- 为什么别人结贴了,且给了我一定的分数,为什么我的总信誉分总是不变?
- 救命啊!!怎么根据数据库中的值在Word里画曲线?
- 有关DriveComboBox1这个控件如何使用的问题?
- DateTimePicker控件的时间格式
- 关于打印的问题,改变默认打印机
- 后缀为pdg的EBook用什么软件打开?
- treeview 和 listview的selected??
- cxgrid里主从表导出excel(注意。是主从表。)
- 有关DataGrid中日期格式问题
- 谁会建access表(*.mdb)?用代码写。
function ExtractFileExt(const FileName: string): string;
楼主可自己跟踪代码,单步调试执行,一般可自己查出错误在哪的