Mega Code Archive

 
Categories / Delphi / Forms
 

Detect a moving form

Title: Detect a moving form You must intercept WM_MOVE message. Implementation of this idea is so: type TForm1 = class(TForm) Label1: TLabel; Label2: TLabel; private procedure MyMessage(var Msg: TWMMove); message WM_MOVE; { Private declarations } public { Public declarations } end; ... procedure TForm1.MyMessage(var Msg: TWMMove); begin if Msg.Result=0 then begin Label1.Caption:='x - '+IntToStr(Msg.XPos); Label2.Caption:='y - '+IntToStr(Msg.YPos); end; end;