Delphi: My window does not maximize! A fast solution.

PHOTO EMBED

Sun Aug 28 2022 12:32:27 GMT+0000 (UTC)

Saved by @marcopinero

procedure TForm1.FormCreate(Sender: TObject);
var
  wplc: TWindowPlacement;
begin
  if not AutoScroll and (WindowState = wsMaximized) then begin
    wplc.length := SizeOf(wplc);
    GetWindowPlacement(Handle, @wplc);
    wplc.rcNormalPosition.Right := wplc.rcNormalPosition.Left + Width;
    wplc.rcNormalPosition.Bottom := wplc.rcNormalPosition.Top + Height;
    wplc.showCmd := SW_MAXIMIZE;
    SetWindowPlacement(Handle, @wplc);
  end;
end;
content_copyCOPY

I used to work with Delphi 7 and several times my main form couldn't get maximized. I could fix this using this very simple piece of code.