Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!vsi1!hsv3!jls From: jls@hsv3.UUCP (James Seidman) Newsgroups: comp.windows.ms.programmer Subject: Tracking the mouse... Message-ID: <5538@hsv3.UUCP> Date: 30 Oct 90 01:11:22 GMT Reply-To: jls@hsv3.UUCP (James Seidman) Organization: Video Seven / Headland Technology Lines: 39 I'm trying to create a child window which can tell when the cursor goes in or out of it. The state of the window needs to be different depending on whether or not the cursor is currently inside it. Now, figuring out when the mouse is inside it is easy, by capturing WM_MOUSEMOVE. However, figuring out when the mouse leaves the window is harder. I can't just use WM_MOUSEMOVE from the parent window, because this won't work if the cursor moves to another child window. Processing WM_SETCURSOR instead will solve that problem, but I still have a problem if the user moves from my child window to outside my parent window quickly enough that no WM_SETCURSOR messages are produced. (The same kind of problem also occurs when the child window is partially obscured by a different app's window, and the user just moves the mouse from my child window to the other app without going through any of my parent window.) Now, what I really would like (and won't get, of course) is a WM message which would specify when the cursor has left my window. Barring that, I've come up with some inelegant solutions: 1) Capture mouse input whenever my child window gets a WM_MOUSEMOVE. Release it when the mouse leaves the window. I hate this because then the user can't use Cntl-Esc, Alt-Tab, etc. to switch apps. 2) Set a mouse clipping rectangle around the child window to ensure that the mouse will go through a piece of the parent window before leaving the app. This solution doesn't address what happens when the app doesn't have the focus, and doesn't work when the child window is partially obscured. There must be a better way. Has anyone grappled with this before? Thanks in advance for any help you might give me. -- Jim Seidman (Drax), the accidental engineer. "It doesn't have to work... they'll be paralyzed just from laughing at me." - Dr. Who, _Shada_ UUCP: ames!vsi1!hsv3!jls INTERNET: hsv3.UUCP!jls@apple.com