Delphi how to prevent maximizing baby MDI?

in the delphi mdi application, you need to show the child window with its title in the Mainform client area when the maximize button is clicked using

Win32Check(Windows.GetClientRect(ClientHandle, aTRect));

MDIChild1.BoundsRect := aTRect;

functions.

So, how can we prevent maximizing the maximum MDI size when clicking the maximize button?

I tried to do this using

procedure TChildText.WMSYSCOMMAND(var Message: TWMSYSCOMMAND);
var
  aTRect:TRect;
begin
  inherited;
  case message.CmdType of
    SC_MAXIMIZE: 
      begin
        Win32Check(Windows.GetClientRect(MainForm.ClientHandle, aTRect));
        BoundsRect := aTRect;
      end;
  end;
end;

without result.

+4
source share
1 answer
procedure TChildText.WMSYSCOMMAND(var Message: TWMSYSCOMMAND);
var
  aTRect:TRect;
begin
  if message.CmdType = SC_MAXIMIZE then
  begin
    Win32Check(Windows.GetClientRect(MainForm.ClientHandle, aTRect));
    BoundsRect := aTRect;
    message.CmdType := SC_RESTORE;
  end;
  inherited;
end;
+1
source

All Articles