Delphi Simple Judge program 30 seconds without keyboard and mouse action sample _delphi

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

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.