8fa956f07f
The instrumented run pinned it down: the FORM is never visible (form_visible_was=False at all four hide points). What shows is the FMX taskbar proxy — app=0 at 20.145, app=854682 at 20.974 — so it is created partway through FormCreate and stayed on screen for the best part of a second until the first hide that could see it. A WinEvent hook on EVENT_OBJECT_SHOW, active only for the --tray startup, hides any top-level window of ours the moment Windows shows it, and is torn down once MinimizeToTray has run. Two details that would each have broken it: - WINEVENT_INCONTEXT, not OUTOFCONTEXT: the latter queues the callback until the thread pumps messages, which does not happen during FormCreate — exactly when the proxy appears. - The pending flag is a unit-level var, not a form field: CreateForm assigns the MainForm global only after the constructor returns, so a callback firing during FormCreate could not have reached the form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>