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;orm

相关文章
相关标签/搜索