diff --git a/dll/cpl/appwiz/addons.c b/dll/cpl/appwiz/addons.c index 32e29f9a46f..b9c089f744f 100644 --- a/dll/cpl/appwiz/addons.c +++ b/dll/cpl/appwiz/addons.c @@ -388,9 +388,17 @@ static DWORD WINAPI download_proc(PVOID arg) static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + HWND hwndProgress, hwndInstallButton; switch(msg) { case WM_INITDIALOG: - ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_HIDE); + + hwndProgress = GetDlgItem(hwnd, ID_DWL_PROGRESS); + if (hwndProgress == GetFocus()) /* Avoid CORE-5737 */ + { + SendMessageW(hwnd, WM_NEXTDLGCTL, 0, FALSE); + } + ShowWindow(hwndProgress, SW_HIDE); + install_dialog = hwnd; return TRUE; @@ -410,7 +418,15 @@ static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case ID_DWL_INSTALL: ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW); - EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0); + + /* CORE-17550: Never leave focus on a disabled control (Old/New/Thing p.228) */ + hwndInstallButton = GetDlgItem(hwnd, ID_DWL_INSTALL); + if (hwndInstallButton == GetFocus()) + { + SendMessageW(hwnd, WM_NEXTDLGCTL, 0, FALSE); + } + EnableWindow(hwndInstallButton, FALSE); + CloseHandle( CreateThread(NULL, 0, download_proc, NULL, 0, NULL)); return FALSE; }