谢谢指点

解决方案 »

  1.   

    用一个全局变量+timer...unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        procedure Timer1Timer(Sender: TObject);
        procedure FormClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    const timeout:Integer=10;
    var
      Form1: TForm1;
       timecount:Integer=0;
    implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);
    begin
       Inc(timecount);
    end;procedure TForm1.FormClick(Sender: TObject);
    begin
       if( timecount>=timeout) then
       begin
          ShowMessage('已超时');
          Exit;
       end;
       timecount:=0;
    end;