Delphi Base

WindSon

导航

Delphi 检测鼠标键盘多久没有活动

function GetInputAwayTime():DWORD;  
var
  lpi:TLastInputInfo;
begin
  lpi.cbSize := sizeof(lpi);
  GetLastInputInfo(lpi);
  Result := Round((GetTickCount()-lpi.dwTime)/1000);
end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
Caption := IntToStr(GetInputAwayTime)
end;

 

posted on 2020-03-28 14:49  windsonvip  阅读(420)  评论(0编辑  收藏  举报