Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Trapping non client areas


How can I trap messages in the non client areas of my form, such as the title bar?   

    Create a message handler for one of the variety of WM_NC (non client) messages available to trap. (search the Windows API help file for WM_NC). This example shows how to track mouse movement in all of the non client areas of the form.

    Example:

    unit Unit ;

    interface

    uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

    type TForm = class(TForm) private procedure WMNCMOUSEMOVE(var Message: TMessage); message WM_NCMOUSEMOVE; { Private declarations } public { Public declarations } end;

    var Form : TForm ;

    implementation

    {$R *.DFM}

    procedure TForm .WMNCMOUSEMOVE(var Message: TMessage); var s : string; begin case Message.wParam of HTERROR : s := 'HTERROR'; HTTRANSPARENT : s := 'HTTRANSPARENT'; HTNOWHERE : s := 'HTNOWHERE'; HTCLIENT : s := 'HTCLIENT'; HTCAPTION : s := 'HTCAPTION'; HTSYSMENU : s := 'HTSYSMENU'; HTSIZE : s := 'HTSIZE'; HTMENU : s := 'HTMENU'; HTHSCROLL : s := 'HTHSCROLL'; HTVSCROLL : s := 'HTVSCROLL'; HTMINBUTTON : s := 'HTMINBUTTON'; HTMAXBUTTON : s := 'HTMAXBUTTON'; HTLEFT : s := 'HTLEFT'; HTRIGHT : s := 'HTRIGHT'; HTTOP : s := 'HTTOP'; HTTOPLEFT : s := 'HTTOPLEFT'; HTTOPRIGHT : s := 'HTTOPRIGHT'; HTBOTTOM : s := 'HTBOTTOM'; HTBOTTOMLEFT : s := 'HTBOTTOMLEFT'; HTBOTTOMRIGHT : s := 'HTBOTTOMRIGHT'; HTBORDER : s := 'HTBORDER'; HTOBJECT : s := 'HTOBJECT'; HTCLOSE : s := 'HTCLOSE'; HTHELP : s := 'HTHELP'; else s := ''; end; Form .Caption := s; Message.Result := 0; end;

    end. 7/ 6/98 4:3 :28 PM

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use