Author: Jonas Bilinkevicius How to detect a form movement Answer: Solve 1: 1 type 2 TForm1 = class(TForm) 3 private 4 { Private declarations } 5 procedure WMEXITSIZEMOVE(var message: TMessage); message WM_EXITSIZEMOVE; 6 procedure WMENTERSIZEMOVE(var message: TMessage); message WM_ENTERSIZEMOVE; 7 8 implementation 9 10 procedure TForm1.WMENTERSIZEMOVE(var message: TMessage); 11 begin 12 Form1.Caption := 'Starting moving and sizing'; 13 end; 14 15 procedure TForm1.WMEXITSIZEMOVE(var message: TMessage); 16 begin 17 Form1.Caption := 'Finished moving and sizing'; 18 end; Solve 2: Handle the WM_MOVING or WM_WINDOWPOSCHANGING message from windows, i.e.: 19 { Private declarations } 20 21 procedure WMWINDOWPOSCHANGING(var msg: TWMWINDOWPOSCHANGING); 22 message WM_WINDOWPOSCHANGING; 23 24 procedure TForm1.WMWINDOWPOSCHANGING(var msg: TWMWINDOWPOSCHANGING); 25 var 26 r: TRect; 27 begin 28 if ((SWP_NOMOVE or SWP_NOSIZE) and msg.WindowPos^.flags) <> (SWP_NOMOVE 29 or SWP_NOSIZE) then 30 begin 31 { Window is moved or sized, get usable screen area } 32 { Do something here } 33 end; 34 inherited; 35 end;