Making your WinControl mouse sensitive
--------------------------------------

Making your component respond to mouse movement in the clientrect is easy.
Just respond to the wmMouseMove messages and your done.
The do the same thing when the mouse moves out of the clientrect is more
complicated. This unit and DLL do the job for you.

The msbitbtn is a demo component which changes the caption color when the
mouse is in the clientrect. All you have to do is respond to the WM_MOUSEMOVE
and the new WM_MOUSEOUT (defined as WM_USER + 501) messages.

In the WM_MOUSEMOVE handler you call SetMouseHook(self.Handle). This call
return TRUE when 1) the dll is loaded 2) there isn't a hook set for this
or another component. The WM_MOUSEOUT handler should call the ReleasMouseHook
function. That's all !!

The method I use prevents 'sticking' control when the user moves the mouse
very fast out of the client area. It works even when you move the mouse fast
out of the application area.

If the DLL could not be found a message dialog is shown with an error message.
The button then just behaves as a normal bitbtn.


This DCU and DLL are released as public domain. If you create components with
this utility let me know, mentioning my name in the docs isn't prohibited
either :)

If you have any problem or suggestion send them to me :

  Willem Joosten
  W.Joosten@pi.net

