mfc >> Detecting mouse over CStatic bitmap

by Nicholas » Mon, 26 Apr 2004 20:19:40 GMT

Hello

I'm trying to detect when a mouse is over one of three CStatic bitmaps, in a
OnMouse function. Unfortunately the OnMouse routine only seems to be called
when the pointer isn't over a static object.

Currently I can get around it by using Set/Release Capture, but is there a
better way?

Nicholas



mfc >> Detecting mouse over CStatic bitmap

by Scott McPhillips [MVP] » Mon, 26 Apr 2004 21:49:55 GMT



When the mouse is over a control the mouse messages go to that control,
not to the parent dialog. Subclass the control and handle the mouse
messages within your subclass. (For a static control it is also
necessary to turn on the 'Notify' style in the control properties.)

--
Scott McPhillips [VC++ MVP]

Similar Threads

1. CWnd & CStatic Based Windows, How to detect mouse leaving the win

2. CWnd and CStatic Based Windows, How to detect mouse leaving the w

Hello,

I am creating a new window class based on CWnd.  I am placing it on the View 
(CFormView).    How can I get the notification or any other indication that 
the cursor/mouse is not on this window?

I also tried the same to create a new window based on CStatic but I was not 
able to detect when the mouse leaves the window.

Regards,
Eitan

3. CWnd & CStatic Based Windows, How to detect mouse leaving the win

4. Detecting Mouse Pointer Over a CStatic

is there a simple way to detect when the mouse pointer 
passes over or is on a CStatic control?

Thanks!

Rick

5. CWnd & CStatic Based Windows, How to detect mouse leaving the win

6. CWnd & CStatic Based Windows, How to detect mouse leaving the

The WM_MOUSEMOVE is good as long as the mouse is in the window boundries.  
However I would like to get some notification the moment the mouse LEAVE the 
window.  
Thanks, Eitan

"Guido Stercken-Sorrenti [MVP VC++]" wrote:

> > I am creating a new window class based on CWnd.  I am placing it on the 
> > View
> > (CFormView).    How can I get the notification or any other indication 
> > that
> > the cursor/mouse is not on this window?
> >
> > I also tried the same to create a new window based on CStatic but I was 
> > not
> > able to detect when the mouse leaves the window.
> 
> The easiest should be handling WM_MOUSEMOVE - or what exactly is the 
> problem?
> 
> -- 
> Guido Stercken-Sorrenti
> MVP - Visual Developer / Visual C++ 
> 
> 
>