delphi里修改下程序
程序代码:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Button2: TButton; Memo1: TMemo; OpenDialog1: TOpenDialog; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function searchfile(path:string):TStringList; var SearchRec:TSearchRec; found:integer; list:TStringList; begin list:=TStringList.Create; found:=FindFirst(path+'\*.*',faAnyFile,SearchRec); while found=0 do begin if (SearchRec.Name<>'.') and (SearchRec.Name<>'..') and (SearchRec.Attr<>faDirectory) then List.Add(SearchRec.Name); found:=FindNext(SearchRec); end; FindClose(SearchRec); searchfile:=list; end; procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines:=searchfile(Edit1.Text); end; end.
这个代码实现的功能: 目录录入Edit1.Text中。搜索的文件,存入Memo1
现在要实现: 那如果 Memo1控件中输出出来的是同名文件 (同名文件样本:wenjian.rtf wenjian.txt) 无所谓什么类型 那该改些什么
窗体上要这样的 [local]1[/local]
如果改不了麻烦重新写下代码