Delphi程序检测键盘静止时间超过5秒

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;
txt 文件大小:312B