[SETUP:REACTOS] Fix initialization of the Finish page

- Ensure the wizard gets shown, centered on the screen, and focused,
  when the Finish page is reached.

- Trigger the change of the "Cancel" wizard dialog button text, not
  from the `WM_INITDIALOG` page handler, but from `PSN_SETACTIVE`.

- Add a `PSN_KILLACTIVE` handler to kill the timer initialized in
  the `PSN_SETACTIVE` handler.

- Add a `PSN_WIZBACK` handler to disable going back in the wizard.
This commit is contained in:
Hermès Bélusca-Maïto
2026-07-24 23:10:04 +02:00
parent da6e675c1b
commit 1648ea7555
+24 -13
View File
@@ -2529,15 +2529,8 @@ FinishDlgProc(
ShowDlgItem(hwndDlg, IDC_RESTART_PROGRESS, SW_HIDE);
}
/* If the installation is aborted, change the "Cancel" button text to "Close" */
if (pSetupData->bStopInstall)
{
SetWindowResTextW(GetDlgItem(hWndParent, IDCANCEL),
GetModuleHandleW(L"comctl32.dll"),
IDS_CLOSE);
}
/* Ensure that the installer wizard window is made visible and focused */
/* Ensure that the wizard window is centered, made visible, and focused */
CenterWindow(hWndParent);
ShowWindow(hWndParent, SW_SHOW);
SwitchToThisWindow(hWndParent, TRUE);
return TRUE;
@@ -2610,11 +2603,15 @@ FinishDlgProc(
pSetupData->hInstance,
IDS_RESTARTBTN);
/* Re-enable the Close/Cancel buttons if we won't reboot */
if (!pSetupData->bMustReboot)
PropSheet_SetCloseCancel(hWndParent, TRUE);
if (pSetupData->bMustReboot)
{
RECT rcBtn1, rcBtn2;
/* Move the "Finish"/"Restart" button to where the "Close"/"Cancel" button is */
/* Move the "Finish"/"Restart" button to where the "Cancel" button is */
GetWindowRect(GetDlgItem(hWndParent, ID_WIZFINISH), &rcBtn1);
MapWindowPoints(HWND_DESKTOP /*NULL*/, hWndParent, (LPPOINT)&rcBtn1, sizeof(RECT)/sizeof(POINT));
GetWindowRect(GetDlgItem(hWndParent, IDCANCEL), &rcBtn2);
@@ -2626,7 +2623,7 @@ FinishDlgProc(
0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
/* Hide and disable also the "Close"/"Cancel" buttons since we can only finish now */
/* Hide and disable also the "Cancel" buttons since we can only finish now */
ShowDlgItem(hWndParent, IDCANCEL, SW_HIDE);
PropSheet_SetCloseCancel(hWndParent, FALSE);
@@ -2639,15 +2636,29 @@ FinishDlgProc(
else if (!pSetupData->bStopInstall)
{
/* Keep the "Cancel" button shown and change its text to "Postpone" */
// PropSheet_ShowWizButtons(hWndParent, 0, PSWIZB_BACK | PSWIZB_NEXT);
SetWindowResTextW(GetDlgItem(hWndParent, IDCANCEL),
pSetupData->hInstance,
IDS_POSTPONEBTN);
}
else // (!bMustReboot && bStopInstall)
{
/* The installation is aborted, change the "Cancel" button text to "Close" */
SetWindowResTextW(GetDlgItem(hWndParent, IDCANCEL),
GetModuleHandleW(L"comctl32.dll"),
IDS_CLOSE);
}
break;
}
case PSN_KILLACTIVE:
KillTimer(hwndDlg, 1);
break;
case PSN_WIZBACK:
/* Always disable going back */
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, -1);
return TRUE;
case PSN_WIZNEXT:
case PSN_WIZFINISH:
{