wsMaximized forms do not appear maximized

I Can reproduce with D7/Win7.

I don’t use wsMaximized at all (similar random problems as you describe).

Workaround: use OnActivate -> ShowWindow(Handle, SW_MAXIMIZE) e.g.:

procedure TForm1.FormActivate(Sender: TObject);
begin
  // Maximize only once when the Form is first activated
  if not FMaxsimized then
  begin
    FMaxsimized := True;
    ShowWindow(Handle, SW_MAXIMIZE);
  end;
end;

This method will not work during OnShow.

Better Workaround: use ShowWindowAsync during OnShow or OnCreate e.g:

procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowWindowAsync(Handle, SW_MAXIMIZE);
end;

This sets the show state of a window without waiting for the operation to complete.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)