When you maximize a Windows program, it will usually resize to fill up the full screen (minus the space occupied by primary controls such as the task bar). What if you don't want your application to change it's size to the size of the screen, yet you don't want to disable the maximize function? All you have to do is catch and handle the WM_GetMinMaxInfo message.
Assuming that the name of your main form's class is TForm1 and that you want your application to "maximize" to half the size of the screen:
Add the following declaration to the interface section of your application's main form (inside the private, public or protected declarations section):
procedure _WM_GETMINMAXINFO(
var mmInfo : TWMGETMINMAXINFO );
message wm_GetMinMaxInfo;
In the implementation section, type in the following code:
procedure TForm1._WM_GETMINMAXINFO(
var mmInfo : TWMGETMINMAXINFO );
begin
//
// set the position and the size of
// your form when maximized:
//
with mmInfo.minmaxinfo^ do
begin
ptmaxposition.x :=
Screen.Width div 4;
ptmaxposition.y :=
Screen.Height div 4;
ptmaxsize.x :=
Screen.Width div 2;
ptmaxsize.y :=
Screen.Height div 2;
end;
end;