Author: Jonas Bilinkevicius
I'm trying to find out where a TForm stores its original values for top, left,
height and width of the form when it is maximizing. It must be stored somewhere
because when I click on restore it goes to its original position and size.
Answer:
Call the GetWindowPlacement function, passing the form's Handle property as the
window handle. Here's a sample function that gets a form's normal bounding
rectangle:
1 2 function GetFormNormalRect(Form: TCustomForm): TRect;
3 var4 Placement: TWindowPlacement;
5 begin6 Placement.length := SizeOf(Placement);
7 ifnot GetWindowPlacement(Form.Handle, @Placement) then8 RaiseLastWin32Error;
9 Result := Placement.rcNormalPosition;
10 end;