关于文件浏览系统的实现,菜鸟急需求救!(100分)

  • 主题发起人 jiadao12
  • 开始时间
J

jiadao12

Unregistered / Unconfirmed
GUEST, unregistred user!
大家请看这段代码:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;

type
TFileCtrForm1 = class(TForm)
DirectoryListBox1: TDirectoryListBox;
DriveComboBox1: TDriveComboBox;
FilterComboBox1: TFilterComboBox;
FileListBox1: TFileListBox;
DirLabel1: TLabel;
FileEdit1: TEdit;
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button2Click(Sender: TObject);
procedure FileListBox1Click(Sender: TObject);
procedure FileEdit1KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
Function NotInList(FileName:String;Items:Tstrings):Boolean;

private

{ Private declarations }
public
end;
implementation

{$R *.dfm}
Type
TSearchRec=record
Time:Integer;
Size:Integer;
Attr:Integer;
Name:TFileName;
ExcludeAttr:Integer;
FindHandle:THandle;
FindData:TWin32FindData;
{ Public declarations }


end;
var
FileCtrForm1: TFileCtrForm1;
Searched: Boolean;


Function TFileCtrForm1.NotInList(FileName:String;Items:Tstrings):Boolean;
Var
i: Integer;
begin
for i:=0 to Items.Count-1 do
if Items=FileName then
begin
NotInList:=False;
Exit;
end;
Result:=True;
end;
procedure TFileCtrForm1.Button2Click(Sender: TObject);
begin
Application.Terminate ;
end;

procedure TFileCtrForm1.FileListBox1Click(Sender: TObject);
begin
if Searched then
begin
Searched:=False;
ListBox1.Items .Clear;
Label3.Caption :='查找结果';
end;
if NotInList(ExtractFileName(FileListBox1.FileName),ListBox1.Items )then
ListBox1.Items .Add(ExtractFileName(FileListBox1.FileName));

end;

procedure TFileCtrForm1.FileEdit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key=#13 then
begin
FileListBox1.ApplyFilePath(FileEdit1.Text);
Key:=#0;
end;

end;

procedure TFileCtrForm1.Button1Click(Sender: TObject);
Var
i: Integer;
SearchRec:TSearchRec;
begin
Searched:=True;
Label3.Caption :='查找结果';
ListBox1.Items .Clear;
FindFirst(FileEdit1.text,FaAnyFile,SearchRec); (就是这行老编不过去,提示types of actu
ListBox1.Items.Add(SearchRec.Name);
Repeat
i:=FindNext(SearchRec);
if i=0 then
ListBox1.Items.Add(SearchRec.Name);
until i<>0;

end;

end.
说明:
FindFirst(FileEdit1.text,
代码:
FaAnyFile,SearchRec); (就是这行老编不过去,提示types of actual
formal var parameters must be identical)
[:(][:(]困了一位菜鸟一夜的问题,愿高手能尽力帮助!
 
顶部