This article for everyone in detail under the Delphi Judge program 30 seconds without keyboard and mouse action, here to the timer set 1000MS parameters, indicating the interval of 30 seconds, the specific implementation of the following, interested friends can refer to ha
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, STD Ctrls, 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:bo Olean);
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;br> end.