PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Robert Eaton on February 11, 2011, 04:48:01 PM

Title: Mouseover (and MouseLeave) for a form
Post by: Robert Eaton on February 11, 2011, 04:48:01 PM
I'm trying to track when the mouse enters and leaves a form (I'm essentially trying to do a flyout form that parks mostly off screen.)

I found an example that uses the TrackMouseEvent API, and that works fine EXCEPT the WM_MouseLeave message also fires whenever the  mouse passes over any controls on the form.
Do I have to somehow track the mouse for every control or is there any easier way?

Any ideas?

Thanks,
Bob



Function FRMMAIN_CUSTOM ( _
                        hWndForm      As Dword, _  ' handle of Form
                        wMsg          As Long,  _  ' type of message
                        wParam        As Dword, _  ' first message parameter
                        lParam        As Long   _  ' second message parameter
                        ) As Long

   Local trackMouseC As TrackMouseEventAPI
   
   Select Case As Long wmsg
      Case %WM_MOUSEMOVE
         trackMouseC.cbSize = SizeOf(trackMouseC)
         trackMouseC.dwFlags = %TME_LEAVE
         trackMouseC.hwndTrack = HWND_FRMMAIN
         TrackMouseEvent(trackMouseC)
         FF_Control_SetText( HWND_FRMMAIN, "Mouse In" )
         
      Case %WM_MOUSELEAVE
         FF_Control_SetText( HWND_FRMMAIN, "Mouse Out" )         
           
  End Select



End Function
Title: Re: Mouseover (and MouseLeave) for a form
Post by: Robert Eaton on February 12, 2011, 05:42:44 PM
Nevermind.

Looks like a better approach will be to use GetCursorPos.