Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do we Get keyboard idle time in delphi

The following code can get the system idle time.

function IdleTime: DWord;
var
  LastInput: TLastInputInfo;
begin
  LastInput.cbSize := SizeOf(TLastInputInfo);
  GetLastInputInfo(LastInput);
  Result := (GetTickCount - LastInput.dwTime) DIV 1000;
end;

Is it possible to get keyboard idle time alone? Let the user move his/her mouse-it doesn't matter. Is it possible to determine, how long the keyboard has been idle?

like image 651
jimsweb Avatar asked Dec 29 '25 10:12

jimsweb


1 Answers

You have to hook to Keyboard event. Check the Keyboard or mouse hooking in Delphi at

http://delphi.about.com/od/kbwinshell/a/delphi_hook.htm

and

http://delphi.about.com/od/windowsshellapi/a/delphi-hooks.htm

You can build your logic over this.

like image 171
Tejasvi Hegde Avatar answered Dec 31 '25 00:12

Tejasvi Hegde



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!