I'd use a TTimer and check for (lack of) keyboard and mouse messages to
indicate idleness.
A component I wrote does this, if you want to take a peek:
>
>"Jon Buckheit" <jonbu...@home.com> wrote in message
>news:5V7J5.350465$i5.54...@news1.frmt1.sfba.home.com...
>> Hi, I am trying to program a Delphi application to do something when it is
>> completely idle for x (user-defined) minutes, but am having problems. I
>> tried to use Application.OnIdle (to compare Now to an idle counter) and
>[...]
>
>I'd use a TTimer and check for (lack of) keyboard and mouse messages to
>indicate idleness.
>
>A component I wrote does this, if you want to take a peek:
>
>http://www.genjerdan.com/bfp/appkiller.htm
Depending on what the app does, you might also want to set a flag if
the program is busy with non-user related tasks.