From 74c40b3fddc937d1884c82355f9fed8a5481ea4a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 12 Apr 2021 21:00:07 -0700 Subject: Avoid activating the engine's windows --- src/engine/pipe.cpp | 2 +- src/engine/uithread.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine/pipe.cpp b/src/engine/pipe.cpp index 67eeae87..47963e9d 100644 --- a/src/engine/pipe.cpp +++ b/src/engine/pipe.cpp @@ -401,7 +401,7 @@ extern "C" HRESULT PipeLaunchChildProcess( // Since ShellExecuteEx doesn't support passing inherited handles, don't bother with CoreAppendFileHandleSelfToCommandLine. // We could fallback to using ::DuplicateHandle to inject the file handle later if necessary. - hr = ShelExec(wzExecutablePath, sczParameters, wzVerb, NULL, SW_HIDE, hwndParent, &hProcess); + hr = ShelExec(wzExecutablePath, sczParameters, wzVerb, NULL, SW_SHOWNA, hwndParent, &hProcess); ExitOnFailure(hr, "Failed to launch elevated child process: %ls", wzExecutablePath); pConnection->dwProcessId = ::GetProcessId(hProcess); diff --git a/src/engine/uithread.cpp b/src/engine/uithread.cpp index 39f92142..433cb171 100644 --- a/src/engine/uithread.cpp +++ b/src/engine/uithread.cpp @@ -134,9 +134,11 @@ static DWORD WINAPI ThreadProc( info.pUserExperience = &pEngineState->userExperience; // Create the window to handle reboots without activating it. - hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, wc.lpszClassName, NULL, WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, SW_SHOWNA, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info); + hWnd = ::CreateWindowExW(WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info); ExitOnNullWithLastError(hWnd, hr, "Failed to create window."); + ::ShowWindow(hWnd, SW_SHOWNA); + // Persist the window handle and let the caller know we've initialized. pEngineState->hMessageWindow = hWnd; ::SetEvent(pContext->hInitializedEvent); -- cgit v1.2.3-55-g6feb