新手问题,高手请进
我想写一个软件
功能如下:
软件界面就三个按钮
点击一个按钮能自动修改D盘下所有RAR文件的后缀,如文件123.rar,自动修改成123.rar1
点击另一个按钮自动修改E盘下的所有RAR文件后缀,效果一样
点击另一个按钮自动修改电脑中所有RAR文件后缀。
另外,功能上实现用户自定位修改后缀的目录,并可自定义任意后缀名
==========
请高手帮我写一个样本软件,光发代码我怕不认识,如果发代码也请发个界面,我才知道怎么弄,最好请高手帮忙写一下,实在太急用了,谢谢各位
好心人帮帮我们新人,我的QQ:176145321 在线等。。。。
[解决办法]
procedure TForm1.Button1Click(Sender: TObject);var s,s1,Directory:string;begin Directory:=Self.DirectoryListBox1.Directory; s:=Self.Edit1.Text; s1:=Self.Edit2.Text; if (s='') or (s1='') then Exit; if s[1]<>'.' then s:='.'+s; if s1[1]<>'.' then s1:='.'+s1; Self.ExtractFileExtt(Directory,s1,s); MessageBox(application.Handle,'扩展名修改完成','信息',MB_OK or MB_ICONINFORMATION);end;procedure TForm1.ExtractFileExtt(directory,expandname_old,expadname_new: string);var searchrec:TSearchRec; s,s1:string;begin if Directory[Length(Directory)] <> '\' then Directory := Directory + '\'; if FindFirst(Directory + '*.*' , faAnyFile, SearchRec) = 0 then begin repeat if (SearchRec.Attr and fadirectory=fadirectory) and (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin ExtractFileExtt(directory+searchrec.Name,expandname_old,expadname_new); end; if SearchRec.Attr and faArchive=faArchive then begin s:=ExtractFileExt(SearchRec.Name); if s=expandname_old then begin s1:=ChangeFileExt(directory+SearchRec.Name,expadname_new); RenameFile(directory+SearchRec.Name,s1) end; end; until FindNext(SearchRec) <> 0; FindClose(SearchRec); end;end;
[解决办法]
兄弟,自定义过程都不会啊
public
//这里加上过程定义
procedure ExtractFileExtt(directory,expandname_old,expadname_new: string);
{ Public declarations }
end;