Get a TForm's normal bounding rectangle (Views: 38)
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.
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:
function GetFormNormalRect(Form: TCustomForm): TRect;
Placement.length := SizeOf(Placement);
if not GetWindowPlacement(Form.Handle, @Placement) then
Result := Placement.rcNormalPosition;
<< Back to main page