码迷,mamicode.com
首页 > Windows程序 > 详细

delphi里修改下程序

时间:2015-02-02 21:19:18      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:

程序代码:
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]
如果改不了麻烦重新写下代码

delphi里修改下程序

标签:

原文地址:http://www.cnblogs.com/gdsf5g46/p/4268580.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!