unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm4 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
function SecondsIdle : DWord;
var
liInfo : TLastInputInfo;
begin
liInfo.cbSize := SizeOf(TLastInputInfo);
GetLastInputInfo(liInfo);
Result := (GetTickCount - liInfo.dwTime) div 1000;
end;
procedure TForm4.Timer1Timer(Sender: TObject);
begin
Label1.Caption := Format('System IDLE Last %d seconds', [SecondsIdle]);
end;
end.