HiHo,
in course of investigating how to use SMF's idle time for background update activity I came up with the following solution.
The program is considered idle after x ms of inactivity (mouse AND keyboard) OR if none of the program's windows are active.
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>
#include <WinAPI.au3>
Local $msg
Global $bIdle = false
Global $iIdle_Time = 10000 ; program considered idle after x ms of inac