Applies to: Subclasser object
See also: MouseEnterChild Event,
MouseLeaveControl Event, Event Index
The MouseEnterChild event occurs when the mouse pointer leaves a child window of the subclassed window.
Syntax:
Private Sub object_MouseLeaveChild(ByVal hWndChild
As Long)
The MouseLeaveChild event syntax has these parts:
Part |
Description |
object |
The name of a Subclasser object, declared using WithEvents. |
hWndChild |
The handle of the child window into which the mouse pointer has moved.
|
Remarks:
The MouseLeaveChild event is only raised if the subclassed window does not
have
mouse input capture, and a MouseEnter event was previously raised for the same
child window. To enable the MouseEnterChild event, call TrackMouse in the MouseEnter
event.
The subclassed window will lose mouse capture when the mouse pointer enters a
child window, thus enabling the MouseLeaveChild event.
Example:
'Because the Subclasser object
relinquishes
'mouse input capture when the mouse pointer
'enters a child control, the following example
'will not interfere with normal mouse events
'generated by controls on the form.
Option Explicit
Private Sub
Form_Load()
Set objmSubclasser =
SubClassWindow(hWnd)
End Sub
Private Sub objmSubclasser_MouseEnter()
'Capture mouse input.
objmSubclasser.TrackMouse
End Sub
Private Sub objmSubclasser_MouseEnterChild(ByVal hWndChild
As Long)
Debug.Print
"EnterChild"
End Sub
Private Sub objmSubclasser_MouseLeaveChild(ByVal hWndChild
As Long)
Debug.Print
"LeaveChild"
End Sub
|
Further examples:
Mouse Roll Over (Hard Way)
|