Home  >  Article  >  Backend Development  >  Delphi simple judgment program without keyboard and mouse movements for 30 seconds example_PHP tutorial

Delphi simple judgment program without keyboard and mouse movements for 30 seconds example_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:16:521040browse

This article will give you a detailed introduction to the Delphi judgment program that there is no keyboard or mouse action for 30 seconds. Here, the parameters of 1000ms) are set for the timer, indicating an interval of 30 seconds. The specific implementation is as follows. Interested friends can refer to it. ​

The following is the original code:
(The timer is set to 1000ms here) parameter, indicating an interval of 30 seconds! !

Copy code The code is 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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/372260.htmlTechArticleThis article introduces in detail the delphi judgment program that there is no keyboard or mouse action for 30 seconds. Here the timer is set to 1000ms) The parameter represents the interval of 30 seconds. The specific implementation is as follows. For those who are interested...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn