delphi簡單判斷程序30秒沒有鍵盤和鼠標(biāo)動作示例
以下為原代碼:
(這里給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.
上一篇:c# 多線程編程 入門篇
欄 目:Delphi
本文標(biāo)題:delphi簡單判斷程序30秒沒有鍵盤和鼠標(biāo)動作示例
本文地址:http://mengdiqiu.com.cn/a1/Delphi/8661.html
您可能感興趣的文章
- 01-10在Delphi實(shí)現(xiàn)在數(shù)據(jù)庫中存取圖像的圖文演示無錯(cuò)
- 01-10delphi建立、讀取、存貯INI文件的方法《三》
- 01-10Delphi Command模式
- 01-10delphi 正弦曲線圖
- 01-10delphi建立、讀取、存貯INI文件的方法《二》
- 01-10插件管理框架 for Delphi(二)
- 01-10插件管理框架 for Delphi(一)
- 01-10Delphi中判斷文件是否為文本文件的函數(shù)
- 01-10delphi中一個(gè)值得大家來考慮的DLL問題
- 01-10初探Delphi中的插件編程


閱讀排行
本欄相關(guān)
- 01-10在Delphi實(shí)現(xiàn)在數(shù)據(jù)庫中存取圖像的圖
- 01-10delphi建立、讀取、存貯INI文件的方法
- 01-10delphi 正弦曲線圖
- 01-10Delphi Command模式
- 01-10delphi建立、讀取、存貯INI文件的方法
- 01-10插件管理框架 for Delphi(二)
- 01-10插件管理框架 for Delphi(一)
- 01-10Delphi中判斷文件是否為文本文件的函
- 01-10delphi中一個(gè)值得大家來考慮的DLL問題
- 01-10初探Delphi中的插件編程
隨機(jī)閱讀
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 01-10delphi制作wav文件的方法
- 01-10使用C語言求解撲克牌的順子及n個(gè)骰子
- 04-02jquery與jsp,用jquery
- 01-10C#中split用法實(shí)例總結(jié)
- 01-11ajax實(shí)現(xiàn)頁面的局部加載
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 08-05織夢dedecms什么時(shí)候用欄目交叉功能?