Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


MFC: Message for mouse leaving a window?

This topic is 6886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

There is no such message. You will have to make a message hook to process every WM_MOUSEMOVE message and check if the mouse left your window. You can then define your own WM_MOVELEFT message and send it to your appication.
I never wrote something like that, but that's the idea I had when I read about that. In fact I tried it myself one or two times, but hooks get your system crashing that fast, you can't believe it. Not nice. Never tried it in WinNT, but Win98 crashes really easy when coding stuff like that...


Alexander Stockinger

Share this post

Link to post
Share on other sites
This was actually a pretty common task, so much so that I guess they decided to add support for it .

Check out API function TrackMouseEvent and the WM_MOUSELEAVE message.



ps. This is only supported for WIN98/NT 4.0 or later.

[This message has been edited by mordell (edited December 15, 1999).]

Share this post

Link to post
Share on other sites
(Yes, that icon means somebody is going to die if I don't get some help here. Probably me.)

I need to know when the mouse is leaving a window in an MFC program... I watch WM_MOUSEMOVE but the last I hear from that is the last point the mouse is at while still inside the window (often not very helpful). None of the other WM events I've tried seem to be able to tell me this... does anyone know how to do it? I'm thinking I could SetCapture the window, then watch WM_MOUSEMOVE for coordinates outside the window and ReleaseCapture, but it seems like a lot of work for something that should be so simple.

Please reply if you have any ideas.



Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!