Delphi 检测用户超过多长时间没有操作键盘或鼠标

procedure TForm1.Timer1Timer(Sender: TObject);
var
vLastInputInfo: TLastInputInfo;
begin
vLastInputInfo.cbSize :
= SizeOf(vLastInputInfo);
GetLastInputInfo(vLastInputInfo);
if GetTickCount - vLastInputInfo.dwTime > 5000 then
begin
timer1.Enabled:
= false;
showmessage(
'超过5秒,用户未动鼠标!');
end;
end;
posted @ 2009-09-14 11:09  novel  阅读(660)  评论(1)    收藏  举报