diff --git a/scratchpad/clickbank.py b/scratchpad/clickbank.py index c0d6fb6..9d0bc56 100644 --- a/scratchpad/clickbank.py +++ b/scratchpad/clickbank.py @@ -60,7 +60,15 @@ def find_windows(substring): buffer = ctypes.create_unicode_buffer(length + 1) user32.GetWindowTextW(hwnd, buffer, length + 1) if substring.lower() in buffer.value.lower() and user32.IsWindowVisible(hwnd): - found.append((hwnd, buffer.value)) + # Skip zero/degenerate clients: the game also owns a + # "BattleTech - Plasma" window with a 0x0 client, and taking + # windows[0] blindly posted every click into it -- 144 clicks, + # zero dispatches, and a scary-looking false regression + # (2026-07-26). A window you cannot click in is not a target. + r = RECT() + user32.GetClientRect(hwnd, ctypes.byref(r)) + if r.right > 50 and r.bottom > 50: + found.append((hwnd, buffer.value)) return True user32.EnumWindows(callback, 0)