监测程序多久没有用户输入

I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
const TimeOut=600000; procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Interval :=TimeOut;
Start:=GetTickCount;
Application.OnMessage :=MyMessage;
end;
 
procedure TForm1.MyMessage(var Msg: TMsg;var Handled: Boolean);
begin
case Msg.message of
WM_MouseMove :Start:=GetTickCount;
WM_LBUTTONDOWN :Start:=GetTickCount;
WM_RBUTTONDOWN :Start:=GetTickCount;
//WM_MOUSEWHEEL :Start:=GetTickCount;
WM_KeyDown :Start:=GetTickCount;
WM_Char :Start:=GetTickCount;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if GetTickCount-Start>=TimeOut then
begin
Start:=GetTickCount;
Application.Minimize;
end;
end;
 

Similar threads

I
回复
0
查看
431
import
I
I
回复
0
查看
472
import
I
I
回复
0
查看
607
import
I
顶部