Mega Code Archive

 
Categories / Delphi / System
 

Drag a captionless window

Title: Drag a captionless window Question: how can i to drag a window without a caption by clicking any where in the form ? Answer: Add the following message in your form header: procedure WMNCHitTest( var Msg : TWMNCHitTest );message wm_NCHitTest; then add the following procedure: procedure TForm1.WMNCHitTest( var Msg : TWMNCHitTest ); begin if GetAsyncKeyState(VK_LButton) Msg.Result := HTCaption else Msg.Result := HTCLient; end;