[FancyZones] Bypass restriction on SetForegroundWindow (#14383)

Co-authored-by: float4 <float4-unspecified-mail>
This commit is contained in:
FLOAT4
2021-11-18 11:16:04 +02:00
committed by GitHub
parent 5a4822f89e
commit 5a9f52fb11
3 changed files with 22 additions and 6 deletions

View File

@@ -594,19 +594,17 @@ ZoneSet::CycleTabs(HWND window, bool reverse) noexcept
for (;;)
{
auto next = GetNextTab(indexSet, window, reverse);
if (next == NULL)
{
break;
}
auto success = SetForegroundWindow(next);
if (!success && GetLastError() == ERROR_INVALID_WINDOW_HANDLE)
// Determine whether the window still exists
if (!IsWindow(next))
{
// Dismiss the encountered window since it was probably closed
DismissWindow(next);
continue;
}
SwitchToWindow(next);
break;
}
}