简体   繁体   中英

How to detect when the mouse is moving outside the window?

I'd like to detect the mouse move event when it's moving outside the window by using MFC. I have used OnNcMouseMove() but it only detects the mouse move event when it's moving to the non-client area, not outside the window. So how can I do to detect while the mouse is moving outside the window?

All I did was set up a 100ms timer that calls GetCursorPos() . You can tweak that timer value to make it higher resolution if needed, but for my specific UI need, 100ms was good enough - it dumped (x,y) coordinates to a status bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM