How to disable form movement using the mouse #52

This is how to prevent a form from being moved using the mouse.

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
  end;

procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);
begin
 inherited;
 with Message do
   if Result = HTCAPTION then
     Result := 0;
end;
Author: Dennis LV
Contributor: Dennis LV
Added: 2007/09/20
Last updated: 2007/09/20