diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-08-03 11:38:57 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-08-03 12:40:37 -0500 |
commit | 7e2a9522351c58c45c7185f9e97b3b2faf1f9c90 (patch) | |
tree | eb9a3448633916cd0e4ba9309ddc66a9ba886abb /src/burn | |
parent | fa54ae44e565d4e8d273627f2fc73e670febeea2 (diff) | |
download | wix-7e2a9522351c58c45c7185f9e97b3b2faf1f9c90.tar.gz wix-7e2a9522351c58c45c7185f9e97b3b2faf1f9c90.tar.bz2 wix-7e2a9522351c58c45c7185f9e97b3b2faf1f9c90.zip |
Make the clean room process replace the splash screen with its own.
This is required to get Windows to automatically transfer foreground focus so that the BA's window or the elevation prompt is automatically activated.
Fixes 6836
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/engine/engine.cpp | 2 | ||||
-rw-r--r-- | src/burn/engine/splashscreen.cpp | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index 413db69b..334ea23b 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
@@ -132,7 +132,7 @@ extern "C" HRESULT EngineRun( | |||
132 | 132 | ||
133 | engineState.command.nCmdShow = nCmdShow; | 133 | engineState.command.nCmdShow = nCmdShow; |
134 | 134 | ||
135 | if (BURN_MODE_ELEVATED != engineState.internalCommand.mode && BOOTSTRAPPER_DISPLAY_NONE < engineState.command.display && !engineState.command.hwndSplashScreen) | 135 | if (BURN_MODE_ELEVATED != engineState.internalCommand.mode && BOOTSTRAPPER_DISPLAY_NONE < engineState.command.display) |
136 | { | 136 | { |
137 | SplashScreenCreate(hInstance, NULL, &engineState.command.hwndSplashScreen); | 137 | SplashScreenCreate(hInstance, NULL, &engineState.command.hwndSplashScreen); |
138 | } | 138 | } |
diff --git a/src/burn/engine/splashscreen.cpp b/src/burn/engine/splashscreen.cpp index 7ba4e630..d8618feb 100644 --- a/src/burn/engine/splashscreen.cpp +++ b/src/burn/engine/splashscreen.cpp | |||
@@ -13,6 +13,7 @@ struct SPLASHSCREEN_INFO | |||
13 | SIZE size; | 13 | SIZE size; |
14 | UINT nDpi; | 14 | UINT nDpi; |
15 | HWND hWnd; | 15 | HWND hWnd; |
16 | HWND hwndPrevious; | ||
16 | }; | 17 | }; |
17 | 18 | ||
18 | struct SPLASHSCREEN_CONTEXT | 19 | struct SPLASHSCREEN_CONTEXT |
@@ -258,6 +259,19 @@ static LRESULT CALLBACK WndProc( | |||
258 | case WM_ERASEBKGND: | 259 | case WM_ERASEBKGND: |
259 | OnEraseBkgnd(pSplashScreen, wParam); | 260 | OnEraseBkgnd(pSplashScreen, wParam); |
260 | return 1; | 261 | return 1; |
262 | |||
263 | case WM_ENTERIDLE: | ||
264 | lres = ::DefWindowProcW(hWnd, uMsg, wParam, lParam); | ||
265 | |||
266 | // We had to create our own splash screen so that Windows would automatically transfer focus from the other process's splash screen. | ||
267 | // Try to make sure new splash screen has painted before closing old one to avoid flickering. | ||
268 | if (pSplashScreen->hwndPrevious) | ||
269 | { | ||
270 | ::PostMessageW(pSplashScreen->hwndPrevious, WM_CLOSE, 0, 0); | ||
271 | pSplashScreen->hwndPrevious = NULL; | ||
272 | } | ||
273 | |||
274 | return lres; | ||
261 | } | 275 | } |
262 | 276 | ||
263 | return ::DefWindowProcW(hWnd, uMsg, wParam, lParam); | 277 | return ::DefWindowProcW(hWnd, uMsg, wParam, lParam); |
@@ -276,6 +290,11 @@ static HRESULT LoadSplashScreen( | |||
276 | DPIU_MONITOR_CONTEXT* pMonitorContext = NULL; | 290 | DPIU_MONITOR_CONTEXT* pMonitorContext = NULL; |
277 | RECT* pMonitorRect = NULL; | 291 | RECT* pMonitorRect = NULL; |
278 | 292 | ||
293 | if (::IsWindow(*pContext->pHwnd)) | ||
294 | { | ||
295 | pSplashScreen->hwndPrevious = *pContext->pHwnd; | ||
296 | } | ||
297 | |||
279 | pSplashScreen->nDpi = USER_DEFAULT_SCREEN_DPI; | 298 | pSplashScreen->nDpi = USER_DEFAULT_SCREEN_DPI; |
280 | pSplashScreen->hBitmap = ::LoadBitmapW(pContext->hInstance, MAKEINTRESOURCEW(pContext->pSplashScreenConfiguration->wResourceId)); | 299 | pSplashScreen->hBitmap = ::LoadBitmapW(pContext->hInstance, MAKEINTRESOURCEW(pContext->pSplashScreenConfiguration->wResourceId)); |
281 | ExitOnNullWithLastError(pSplashScreen->hBitmap, hr, "Failed to load splash screen bitmap."); | 300 | ExitOnNullWithLastError(pSplashScreen->hBitmap, hr, "Failed to load splash screen bitmap."); |