What I want to do is check if my application has focus because if it is not then I will popup an Alert Window just over the Notification Area to display some message to the end user.
Call Windows.GetForegroundWindow()
and then pass the HWND
to the Controls.FindControl()
function. It will return a non-nil TWinControl
pointer if the HWND
belongs to your process. For example:
if FindControl(GetForegroundWindow()) <> nil then
// has focus ...
else
// does not have focus ...