delphi簡單判斷程序30秒沒有鍵盤和鼠標(biāo)動作示例
更新時間:2013年06月28日 16:53:05 作者:
本文為大家詳細(xì)介紹下delphi判斷程序30秒沒有鍵盤和鼠標(biāo)動作,這里給timer設(shè)置了1000ms)的參數(shù),表示30秒的間隔,具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下哈
以下為原代碼:
(這里給timer設(shè)置了1000ms)的參數(shù),表示30秒的間隔??!
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.
(這里給timer設(shè)置了1000ms)的參數(shù),表示30秒的間隔??!
復(fù)制代碼 代碼如下:
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.
相關(guān)文章
delphi7連接mysql5的實(shí)現(xiàn)方法
這篇文章主要介紹了delphi7連接mysql5的實(shí)現(xiàn)方法,需要的朋友可以參考下2014-07-07Delphi實(shí)現(xiàn)判斷網(wǎng)址是否存在及是否可以打開的方法
這篇文章主要介紹了Delphi實(shí)現(xiàn)判斷網(wǎng)址是否存在及是否可以打開的方法,需要的朋友可以參考下2014-07-07Delphi實(shí)現(xiàn)限定軟件使用時間的方法
這篇文章主要介紹了Delphi實(shí)現(xiàn)限定軟件使用時間的方法,商業(yè)軟件開發(fā)中非常實(shí)用的功能,需要的朋友可以參考下2014-07-07Delphi實(shí)現(xiàn)木馬文件傳輸代碼實(shí)例
這篇文章主要介紹了Delphi實(shí)現(xiàn)木馬文件傳輸?shù)姆椒?對于了解木馬的運(yùn)行原理有一定的幫助,需要的朋友可以參考下2014-07-07Delphi實(shí)現(xiàn)圖像文本旋轉(zhuǎn)特效完整實(shí)例代碼
這篇文章主要介紹了Delphi實(shí)現(xiàn)圖像文本旋轉(zhuǎn)特效完整實(shí)例代碼,對于幫助讀者進(jìn)一步理解Delphi圖形及文字特效的處理有一定的借鑒價值,需要的朋友可以參考下2014-07-07delphi簡單判斷程序30秒沒有鍵盤和鼠標(biāo)動作示例
本文為大家詳細(xì)介紹下delphi判斷程序30秒沒有鍵盤和鼠標(biāo)動作,這里給timer設(shè)置了1000ms)的參數(shù),表示30秒的間隔,具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下哈2013-06-06Delphi用TActionList實(shí)現(xiàn)下載文件的方法
這篇文章主要介紹了Delphi用TActionList實(shí)現(xiàn)下載文件的方法,需要的朋友可以參考下2014-07-07Java中CountDownLatch和CyclicBarrier的區(qū)別與詳解
CountDownLatch和CyclicBarrier是Java并發(fā)包提供的兩個非常易用的線程同步工具類,本文主要介紹了Java中CountDownLatch和CyclicBarrier的區(qū)別與詳解,具有一定的參考價值,感興趣的可以了解一下2023-11-11