include("../include.php"); writeHeader("Mouse `exit` event", "Programming » Visual Basic 6 » Visual Basic 6 Code » Mouse » ");?>
'Put this in a module: '//*********************************//' Public Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long Public Declare Function ReleaseCapture Lib "user32" () As Long 'Put this in the mouse_move event of your control: '//*********************************//' With cmdButton 'Change this to the name of the control If Button = 0 Then If (x < 0) Or (y < 0) Or (x > .Width) Or (y > .Height) Then 'Mouse pointer is outside button, so let other controls receive 'mouseevents too: ReleaseCapture ' Do your 'mouse-exit' stuff here Else ' Mouse pointer is over button, so we'll capture it, thus ' we'll receive mouse messages even if the mouse pointer is ' not over the button SetCapture .hwnd ' Do your 'mouse-enter' stuff here End If End If End With