fix(startup): start the proxy watcher from the .dpr, before the form exists

Decisive observation: the taskbar button is already up before FormCreate is
entered. Everything I had tried lived inside the form, so all of it ran after
the button was drawn — the watcher included, which is why moving it around
never helped.

StartTrayProxyHider is now exported from UMainForm and called from the .dpr
right after Application.Initialize, before CreateForm. It polls every 5 ms and
hides our TFMAppClass proxy unconditionally (the button can be up before
WS_VISIBLE reads as set, which the previous IsWindowVisible check would have
skipped), stopping as soon as the tray startup completes so a user restoring
from the tray is never fought.

Raw Win32 only — FindWindowEx + ShowWindow, no FMX object touched at that
point, which is what made the earlier .dpr attempt crash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-27 13:15:32 +01:00
parent 4f2aff9de4
commit ab8186ef75
3 changed files with 61 additions and 24 deletions
+6
View File
@@ -127,4 +127,10 @@ object MainForm: TMainForm
Left = 424
Top = 240
end
object Timer1: TTimer
Interval = 1
OnTimer = Timer1Timer
Left = 568
Top = 184
end
end