change the height and width of a foreign window?

Author: Thomas Stutz 

 

 

{

  The function ChangeSize does the following:

 

  SomeWindow.Height = SomeWindow.Height + dHeight

  (where dHeight is change in Height)

  SomeWindow.Width = SomeWindow.Width + dWidth

 

  ChangeSize doesn't change the top/left of the specific window.

 

  Die Funktion ChangeSize macht folgendes:

 

  EinFenster.Height = EinFenster.Height + dHeight

  (Wobei dHeight die den Höhenunterschied angibt)

  EinFenster.Width = EinFenster.Width + dWidth

 

  Die Funktion ChangeSize ändert Top/Left des Fensters nicht.

}

 

procedure ChangeSize(Handle: Hwnd; dHeight, dWidth: Integer);

var

  P: TRect;

  DlgWidth: integer;

  DlgHeight: integer;

begin

  GetWindowRect(Handle, P);

  DlgWidth  := P.Right - P.Left;

  DlgHeight := P.Bottom - P.Top;

  MoveWindow(Handle, P.Left, P.Top, DlgWidth + dHeight, DlgHeight + dWidth, True);

end;