Forms Delphi

Title: Stop form from being moved (improved)
Question: How can I stop a form being moved (by mouse/keyboard/dbl clicking title bar)?
Answer:
This will stop the 'mouse drag caption move', the 'ALT-SPACE, Move, cursor keys', and the 'mouse double click caption=restore'.
TForm1 = class (TForm)
private
procedure WMWindowPosChanging(var Message: TWMWindowPosMsg); message WM_WINDOWPOSCHANGING;
end;
procedure TForm1.WMWindowPosChanging(var Message: TWMWindowPosMsg);
begin
// the following line is needed as Delphi/Windows would NEVER be able to position form
if (not Visible) then Exit;
with Message do begin
WindowPos.X:=Left;
WindowPos.Y:=Top;
Result:=0;
end;
end;
Note: if you don't include the 'if not visible' line, your form cannot be 'initially' positioned.