Detect Idle Time in Multi-Device Application on OSX

Viewed 1028

I need to detect Idle Time, Time Since the user has input anything into their machine, I've made this application before for windows only and this function worked brilliantly :-

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

However, this function doesn't work on Multi-Device Application(as far as I can tell). I've messed around with this for a while now and done some severe googling to no avail.

The target OS is OS X and Windows.

1 Answers
Related