mouse leaving a window? 
Author Message
 mouse leaving a window?

Sorry if the answer is too obious.

In my app the user can drag an item with the mouse
as long as the (mouse-) button is pressed. When the
user leaves the window and releases the mouse button
(outside the window) I don't get an "OnLButtonUp"
message for my window (of course not).

How am I informed that the mouse has left my window?
I tried spy++ but I didn't find a message that
would help me.

Or is there a way to check the state of the mouse
button as soo as the mouse enters the window again?

Bye & Thanks,
Martin



Mon, 31 Jul 2000 03:00:00 GMT  
 mouse leaving a window?

Quote:
> Sorry if the answer is too obious.

> In my app the user can drag an item with the mouse
> as long as the (mouse-) button is pressed. When the
> user leaves the window and releases the mouse button
> (outside the window) I don't get an "OnLButtonUp"
> message for my window (of course not).

> How am I informed that the mouse has left my window?
> I tried spy++ but I didn't find a message that
> would help me.

> Or is there a way to check the state of the mouse
> button as soo as the mouse enters the window again?

Martin,
Look into SetCapture() and ReleaseCapture().
This causes all mouse events to be sent to your window, regardless if the
mouse is on the window.

cU
--

                        http://djuga.home.ml.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retriever 1.0 is out:   http://retriever.home.ml.org

Shareware image viewer, thumbnailer & database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Mon, 31 Jul 2000 03:00:00 GMT  
 mouse leaving a window?

You can accomplish this by capturing the mouse.

In your view's OnMouseMove function check to see if
this view has the mouse captured - if not capture the
mouse with SetCapture()

Then check to see if the mouse co-ords are within the
client rect of the view. If not, then the mouse has left
the view - ReleaseCapture(), and carry on as normal.

Pete

(remove the XXX to e-mail)



Mon, 31 Jul 2000 03:00:00 GMT  
 mouse leaving a window?

Quote:
>In my app the user can drag an item with the mouse
>as long as the (mouse-) button is pressed. When the
>user leaves the window and releases the mouse button
>(outside the window) I don't get an "OnLButtonUp"
>message for my window (of course not).

Martin,

Are you capturing the mouse on your button down event using
SetCapture?

Dave
----
Address is altered to discourage junk mail.
Remove ".---" for the real address.
http://www.bj.co.uk



Mon, 31 Jul 2000 03:00:00 GMT  
 mouse leaving a window?



[...]

Quote:
> Martin,
> Look into SetCapture() and ReleaseCapture().
> This causes all mouse events to be sent to your window, regardless if the
> mouse is on the window.

Bingo!
Thank you very much.

Martin



Tue, 01 Aug 2000 03:00:00 GMT  
 mouse leaving a window?



[...]

Quote:

> Martin,

> Are you capturing the mouse on your button down event using
> SetCapture?

I wasn't, but now I am. Thanks.

Martin



Tue, 01 Aug 2000 03:00:00 GMT  
 mouse leaving a window?



[...]

Quote:
> You can accomplish this by capturing the mouse.

Thank you very much - that's what I was looking for.

Martin



Tue, 01 Aug 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Q:How to handle the event while mouse leaves a window?

2. How do you tell when the mouse *leaves* your window?

3. Mouse leaving window notfication?

4. How can I tell when mouse leaves window?

5. Add Left Mouse Down Message for a ToolBar Class

6. Detecting when a mouse leaves a control

7. Testing when mouse leaves client area

8. Left mouse button up in CListView

9. Toggling the mouse buttons from right to left

10. Left Mouse Down not always triggering message handler

11. CListCtrl left mouse click event handler

12. How to capture nonclient area mouse leave

 

 
Powered by phpBB® Forum Software