The following is the original code:
(The timer is set to 1000ms), indicating 30 seconds interval!!
Copy Code code as follows:
Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls, Extctrls;
Type
TForm1 = Class (Tform)
Memo1:tmemo;
Button1:tbutton;
Timer1:ttimer;
Procedure Timer1timer (Sender:tobject);
Procedure Button1Click (Sender:tobject);
Private
{Private declarations}
Public
Procedure Appmessagehandler (var msg:tmsg;var handled:boolean);
{Public declarations}
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
{TForm1}
Procedure Tform1.appmessagehandler (var msg:tmsg; var handled:boolean);
Begin
if (Msg.message=wm_mousemove) or (Msg.message=wm_keydown) then timer1.tag:=0;
End
Procedure Tform1.timer1timer (Sender:tobject);
Begin
timer1.tag:=timer1.tag+1;
If Timer1.tag=30 then close;
End
Procedure Tform1.button1click (Sender:tobject);
Begin
Close
End
End.