@joebigelow / wix / commits / 74c40b3f

Avoid activating the engine's windows

Rob Mensching committed Apr 12, 2021 at 21:00 UTC 74c40b3fddc937d1884c82355f9fed8a5481ea4a
2 files changed +4 -2
src/engine/pipe.cpp
+1 -1
@@ -401,7 +401,7 @@ extern "C" HRESULT PipeLaunchChildProcess(
401
402 // Since ShellExecuteEx doesn't support passing inherited handles, don't bother with CoreAppendFileHandleSelfToCommandLine.
403 // We could fallback to using ::DuplicateHandle to inject the file handle later if necessary.
404 - hr = ShelExec(wzExecutablePath, sczParameters, wzVerb, NULL, SW_HIDE, hwndParent, &hProcess);
404 + hr = ShelExec(wzExecutablePath, sczParameters, wzVerb, NULL, SW_SHOWNA, hwndParent, &hProcess);
405 ExitOnFailure(hr, "Failed to launch elevated child process: %ls", wzExecutablePath);
406
407 pConnection->dwProcessId = ::GetProcessId(hProcess);
src/engine/uithread.cpp
+3 -1
@@ -134,9 +134,11 @@ static DWORD WINAPI ThreadProc(
134 info.pUserExperience = &pEngineState->userExperience;
135
136 // Create the window to handle reboots without activating it.
137 - hWnd = ::CreateWindowExW(WS_EX_TOOLWINDOW, wc.lpszClassName, NULL, WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, SW_SHOWNA, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info);
137 + hWnd = ::CreateWindowExW(WS_EX_NOACTIVATE, wc.lpszClassName, NULL, WS_POPUP, 0, 0, 0, 0, HWND_DESKTOP, NULL, pContext->hInstance, &info);
138 ExitOnNullWithLastError(hWnd, hr, "Failed to create window.");
139
140 + ::ShowWindow(hWnd, SW_SHOWNA);
141 +
142 // Persist the window handle and let the caller know we've initialized.
143 pEngineState->hMessageWindow = hWnd;
144 ::SetEvent(pContext->hInitializedEvent);