function ForegroundTask: Boolean;
extern DELPHI_PACKAGE bool __fastcall ForegroundTask(void);
Indicates whether the current thread is running in the foreground.
Call ForegroundTask to determine whether the current thread is executing in the Foreground. This is useful if you want to provide feedback to users only if they are currently interacting with a window on the same thread, but do not want to interrupt other processes.
ForegroundTask checks whether the window that currently has focus belongs to the thread that executes the function. It returns true if the focused window belongs to the current thread, false otherwise.