Skip to content

fix(companion): stay on top after the foreground lock timeout - #5

Merged
AlexDXC2026 merged 1 commit into
mainfrom
fix/overlay-foreground-lock
Nov 18, 2026
Merged

AlexDXC2026 merged 1 commit into
mainfrom
fix/overlay-foreground-lock

Conversation

@AlexDXC2026

Copy link
Copy Markdown
Owner

Problem

After the app had been running for a few minutes, a copied link opened the floating window behind WoW. Diagnostic log from the real game: visible = True · topmost = False.

Cause

Windows foreground lock: once the start-up grace period (ForegroundLockTimeout = 200000 ms here) ends, SetWindowPos(HWND_TOPMOST) from a background process is refused while the game has the focus. Tests right after starting the app passed, which hid it.

Fix

  • TopMost is set before the handle is created, so the window is born with WS_EX_TOPMOST.
  • If Windows still refuses, retry once with AttachThreadInput to the foreground thread (focus does not move); logged.

Verified

Started the app, waited 215 s with WoW in the foreground, then copied a link: topmost = True, z-order above World of Warcraft.

🤖 Generated with Claude Code

Windows refuses SetWindowPos(HWND_TOPMOST) from a background app once
its start-up grace period (ForegroundLockTimeout, 200 s) ends, so after
a few minutes the floating window opened behind the game again. The form
is now created topmost, and a refused call is retried while attached to
the foreground thread input (focus does not move).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AlexDXC2026
AlexDXC2026 merged commit f718bc8 into main Nov 18, 2026
2 checks passed
@AlexDXC2026
AlexDXC2026 deleted the fix/overlay-foreground-lock branch November 18, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant