From: Anders <andersdev@proton.me> --- dlls/wshom.ocx/shell.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c index 8b435163d3c..879d7d39e1c 100644 --- a/dlls/wshom.ocx/shell.c +++ b/dlls/wshom.ocx/shell.c @@ -1879,6 +1879,10 @@ static HRESULT WINAPI WshShell3_AppActivate(IWshShell3 *iface, VARIANT *App, VAR DWORD othertid = GetWindowThreadProcessId(hWnd, &pid); BOOL attached = AttachThreadInput(mytid, othertid, TRUE); SetForegroundWindow(hWndTarget); + SetLastError(0); + hr = (SetFocus(hWndTarget) || !GetLastError()) ? S_OK : S_FALSE; + if (attached) + AttachThreadInput(mytid, othertid, FALSE); V_VT(&vTmp) = VT_EMPTY; if (Wait && !is_optional_argument(Wait) && SUCCEEDED(VariantChangeType(&vTmp, Wait, 0, VT_BOOL)) && V_BOOL(&vTmp)) @@ -1887,10 +1891,6 @@ static HRESULT WINAPI WshShell3_AppActivate(IWshShell3 *iface, VARIANT *App, VAR for (; wait && GetForegroundWindow() != hWndTarget; wait -= interval) Sleep(interval); } - SetLastError(0); - hr = (SetFocus(hWndTarget) || !GetLastError()) ? S_OK : S_FALSE; - if (attached) - AttachThreadInput(mytid, othertid, FALSE); } if (out_Success) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11157