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

相關文章
相關標籤/搜索