{"id":123,"date":"2007-05-12T14:38:25","date_gmt":"2007-05-12T12:38:25","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/moving-forms-without-a-caption-bar\/"},"modified":"2007-05-12T14:38:27","modified_gmt":"2007-05-12T12:38:27","slug":"moving-forms-without-a-caption-bar","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/moving-forms-without-a-caption-bar\/","title":{"rendered":"Moving Forms without a caption bar"},"content":{"rendered":"<p><em>Thomas wrote:<\/p>\n<p>> Hi Kire,<br \/>\n><br \/>\n> If I can remember, the method to perform such operation was to hook the<br \/>\n> WM_NCHITTEST message and re-direct it to the caption bar ; thus, u fake a<br \/>\n> click on the caption bar so your form can move.<br \/>\n> Regards,<br \/>\n>     Thomas.<br \/>\n<\/em><br \/>\n<!--more--><br \/>\nVon: Juan Jos?Grajeda<br \/>\nBetreff: Re: Moving formswithout caption bar.<br \/>\nDatum: Dienstag, 30. M\u00e4rz 1999 01:35<\/p>\n<p>The method Thomas say is this:<br \/>\n[code lang=&#8221;delphi&#8221;]<br \/>\n       TForm1 = Class(TForm);<br \/>\n       &#8230;<br \/>\n       private<br \/>\n          procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;<br \/>\n       &#8230;<br \/>\n      end;<\/p>\n<p>          procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);<br \/>\n          begin<br \/>\n            inherited;<br \/>\n             if M.Result = htClient then { Test if you are in the client area<br \/>\n}<br \/>\n              M.Result := htCaption;    { change it to the caption area}<br \/>\n          end;<br \/>\n[\/code]<br \/>\nThis are other ht constants<br \/>\n     HTBORDER,  HTBOTTOM,  HTBOTTOMLEFT,  HTBOTTOMRIGHT,  HTCAPTION,<br \/>\n     HTCLIENT,  HTERROR,  HTNOWHERE,  HTGROWBOX, HTHSCROLL,  HTLEFT,<br \/>\n     HTMENU,  HTNOWHERE,   HTREDUCE,  HTRIGHT,   HTSIZE,   HTSYSMENU,<br \/>\n     HTTOP,   HTTOPLEFT,    HTTOPRIGHT &#8211; Canto direito superior da janela<br \/>\n     HTTRANSPARENT,   HTVSCROLL,   HTZOOM<\/p>\n<p>Regards,<br \/>\n   Juan Jose<\/p>\n<p>To hook the WM_NCHITTEST message is only the solution if the user has<br \/>\nthe possibility to do a click at the form directly. If the form is<br \/>\ncovered by e.g. a panel then you can use <\/p>\n<p>[code lang=&#8221;delphi&#8221;]procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;<br \/>\n    Shift: TShiftState; X, Y: Integer);<br \/>\nconst<br \/>\n  SC_DRAGMOVE = $F012; \/\/ a magic number, no idea where it&#8217;s documented<br \/>\nbegin<br \/>\n  if Button = mbLeft then<br \/>\n    begin<br \/>\n      ReleaseCapture;<br \/>\n      Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);<br \/>\n    end;<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>Good luck!<br \/>\nToni<\/p>\n<p>Toni Sanders wrote:<\/p>\n<p>> SC_DRAGMOVE = $F012; \/\/ a magic number, no idea where it&#8217;s documented<\/p>\n<p>That Number comes from: SC_DRAGMOVE = SC_Move + htCaption<\/p>\n<p>this command emulates the the user action clicking the caption of a window to move.<br \/>\nIf you don&#8217;t add htCaption the command is handled by the keyboard instead.<\/p>\n<p>best regards<br \/>\nJuan Jose<\/p>\n<p>[tags]Delphi, Forms[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thomas wrote: > Hi Kire, > > If I can remember, the method to perform such operation was to hook the > WM_NCHITTEST&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,100],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-1Z","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/123"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}