[WINLOGON] Let the dialog manager manage the default focus (#8337)

- The single default button in the "Shutdown Computer" and "GINA failed
  to load" dialogs will be automatically focused by the dialog manager,
  so there is no need to invoke `SetFocus()` in their `WM_INITDIALOG`
  handler -- which also erroneously returned `TRUE`, thus ignoring any
  focus set by the caller :D

- Use `DeleteMenu()` instead of `RemoveMenu()` so that it'll free any
  memory resources.
This commit is contained in:
Hermès Bélusca-Maïto
2025-08-14 22:06:31 +02:00
parent 35ecbde693
commit bded90874e
2 changed files with 2 additions and 4 deletions

View File

@@ -1122,8 +1122,8 @@ ShutdownComputerWindowProc(
}
case WM_INITDIALOG:
{
RemoveMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND);
SetFocus(GetDlgItem(hwndDlg, IDC_BTNSHTDOWNCOMPUTER));
/* Remove the Close menu item */
DeleteMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND);
return TRUE;
}
}

View File

@@ -431,8 +431,6 @@ GinaLoadFailedWindowProc(
wsprintfW(text, templateText, (LPWSTR)lParam);
SetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, text);
}
SetFocus(GetDlgItem(hwndDlg, IDOK));
return TRUE;
}