熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> PHP編程 >> 正文

delphi簡單判斷程序30秒沒有鍵盤和鼠標動作示例

2022-06-13   來源: PHP編程 
本文為大家詳細介紹下delphi判斷程序秒沒有鍵盤和鼠標動作這裡給timer設置了ms)的參數表示秒的間隔具體實現如下感興趣的朋友可以參考下哈  

  以下為原代碼
(這裡給timer設置了ms)的參數表示秒的間隔!!

復制代碼 代碼如下:

  
unit Unit;
interface
uses
Windows Messages SysUtils Variants Classes Graphics Controls Forms
Dialogs StdCtrls ExtCtrls;
type
TForm = class(TForm)
Memo: TMemo;
Button: TButton;
Timer: TTimer;
procedure TimerTimer(Sender: TObject);
procedure ButtonClick(Sender: TObject);
private
{ Private declarations }
public
procedure AppMessageHandler(var Msg:TMsg;var Handled:Boolean);
{ Public declarations }
end;
var
Form: TForm;
implementation
{$R *dfm}
{ TForm }
procedure TFormAppMessageHandler(var Msg: TMsg; var Handled: Boolean);
begin
if (msgmessage=WM_MOUSEMOVE) or (msgmessage=WM_KEYDOWN) then timertag:=;
end;
procedure TFormTimerTimer(Sender: TObject);
begin
timertag:=timertag+;
if Timertag= then close;
end;
procedure TFormButtonClick(Sender: TObject);
begin
close;
end;
end


From:http://tw.wingwit.com/Article/program/PHP/201311/21226.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.