function
StopTime:
integer
;
//返回没有键盘和鼠标事件的时间
var
LInput: TLastInputInfo;
begin
LInput
.
cbSize := SizeOf(TLastInputInfo);
GetLastInputInfo(LInput);
Result := (GetTickCount() - LInput
.
dwTime)
div
1000
;
// 微妙换成秒
end
;
procedure
TForm1
.
Timer1Timer(Sender: TObject);
// Timer 事件
begin
if
StopTime >=
60
then
Showmessage(
'用户已经1分钟没有动键盘鼠标了!'
);
end
;