Delphi Simple Judge Program 30 seconds without keyboard and mouse action sample

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.