unit button;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Label1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
function GetFileCount(srcPath, srcFileName: string): Integer;
var
FileRec: TSearchrec;
currPath: string;
begin
if srcPath[Length(srcPath)] <> '\' then srcPath := srcPath + '\';
currPath := srcPath + '*.*';
Result := 0;
if FindFirst(currPath, faAnyFile, FileRec) = 0 then
repeat
if ((FileRec.Attr and faDirectory) <> 0) and
(FileRec.Name <> '.') and
(FileRec.Name <> '..') then
begin
Result := Result + GetFileCount(srcPath + FileRec.Name, srcFileName);
end else
if AnsiCompareText(srcFileName, FileRec.Name) = 0 then
Result := Result + 1;
until FindNext(FileRec) <> 0;
end;
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
function GetFileCount(srcPath, srcFileName: string): Integer;
end;
procedure TForm1.Label1Click(Sender: TObject);
begin
label1.caption:='333333'
end;
end.
如何在button1窗体下调用函数过程
当年话下