Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Nov : Windows Messages Hooking Question

www.cryer.info
Managed Newsgroup Archive

Windows Messages Hooking Question

Subject:Windows Messages Hooking Question
Posted by:"Marcelo Grossi" (magros..@nelogica.com.br)
Date:Fri, 17 Nov 2006 16:20:04

Hello All,

    I have a litte component (made from TWidget) that draws a title bar
button. I've given up on trying to make windows draw the button for me and
managed to make a pretty decent-looking button myself (see several posts
below).
    I've fixed most of the original components erratic behaviour (most due
to some minor bug fixes) but there is one that is still troubling me. There
are certain events that make my button disapear (for a short period) like
for instance when I minimize my window.
    The question is:
    - Wich Messages should I process? I'm currently processing the following
messages:

    wm_ncpaint
    wm_ncactivate
    wm_lbuttondown
    wm_nclbuttondown
    wm_mousemove
    wm_ncmouseleave
    wm_ncmousemove
    wm_nclbuttondblclk
    wm_lbuttonup
    wm_lbuttondblclk
    wm_size
    wm_windowposchanged
    wm_settingchange
    wm_stylechanged
    wm_themechanged
    wm_destroy

BTW: I've trapped all of my Windows messages with the following code:
******
Create
******
  // subclass the owner to catch all its messages
  NewWndProc := MakeObjectInstance(NewWndMethod);
  OldWndProc := pointer(SetWindowLong((AOwner as TForm).Handle, gwl_WndProc,
longint(NewWndProc)));

******
Destroy
******
  if Assigned(NewWndProc) and Assigned(Owner) then
  begin
    SetWindowLong((Owner as TForm).Handle, gwl_WndProc,
longint(OldWndProc));
    FreeObjectInstance(NewWndProc);
  end;

Thanks in advance,

Marcelo Grossi

Replies:

www.cryer.info
Managed Newsgroup Archive