當視窗位置移動或尺寸更改或者呼叫 API: SetWindowPos 都會觸發
WM_WINPOSCHAGNED 訊息
以下程式片段示範了如何攔截 WM_WINPOSCHAGNED 訊息:
-----------------------------------------------------------------
type
  TForm1 = class(TForm)
  private
    FNowLeft, FNowTop, FNowWidth, FNowHeight: Integer;
  protected
    procedure OnWinPosChanged(var Msg: TMessage); message
              WM_WINDOWPOSCHANGED;
  end;

implementation

procedure TForm1.OnWinPosChanged(var Msg: TMessage);
var
  pWinPos: PWindowPos;  // 參考 Delphi\Source\Rtl\Win\Window.pas
begin
  inherited;

  pWinPos := PWindowPos(Msg.LParam);
  if WindowState = wsNormal then
  begin
    FNowLeft := pWinPos.x;
    FNowTop := pWinPos.y;
    FNowWidth := pWinPos.cx;
    FNowHeight := pWinPos.cy;
  end;
  Msg.Result := 0;
end;


    Source: geocities.com/huanlin_tsai/faq

               ( geocities.com/huanlin_tsai)