Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!news.funet.fi!funic!santra!fuug!tuura!risto From: risto@tuura.UUCP (Risto Lankinen) Newsgroups: comp.windows.ms.programmer Subject: Re: Tracking the mouse... Message-ID: <823@tuura.UUCP> Date: 31 Oct 90 08:18:22 GMT References: <5538@hsv3.UUCP> Organization: Nokia Data Systems Oy Lines: 32 jls@hsv3.UUCP (James Seidman) writes: >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. Hi! You could try polling the mouse with GetCursorPos() within the application's message loop, and check whether the cursor is inside the desired child window by calling WindowFromPoint() . If it were, you could act directly, or, more elegantly, send that window a self-defined WM_USER message with wParam set to indicate cursor entering / exiting status when the hWnd returned by Window- FromPoint() has changed. This could also be made as a DLL were there a need to cooperate among many instances of the same application. The DLL would contain a 'windowless' process to poll the mouse position and two functions which the application uses to register a window being checked + the corresponding event handler, and to un-register the service before the application terminates. Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************