Check to see if cursor was outside client area of a listview controlAdd a form to a new project.Add a listview control to the form created aboveAdd a module to the projectDouble-click the module and type in the following code segment
<a href="" target="_blank">
Public Type POINTAPI
   x as Long
   y as Long
End Type

Public Declare Function GetCursorPos lib "user32" Alias "GetCursorPos" (ByRef lpPoint as POINTAPI) As Long
Public Declare Function ScreenToClient lib "user32" Alias "ScreenToClient" (ByVal hwnd as Long, ByRef lpPoint as POINTAPI) As Long
Public Declare Function SetCapture(ByVal hwnd as Long) as Long
Public Declare Function ReleaseCapture() As Long

Double-click the listview control and select the mousemove event from the dropdown box at top of editor window.
Copy and paste the code below in the event handler

<a href="" target="_blank">
Static captured As Boolean

Dim currentPoint AS POINTAPI

     currentPoint.x = x
     currentPoint.y = y

     GetCursorPos currentPoint
     ScreenToClient Me.Hwnd, currentPoint

    If Not (captured) Then
         SetCapture Me.Hwnd
         captured = True
    End If

    If (CurrentPoint.X < ListView2.left Or CurrentPoint.X > ListView2.left + ListView2.Width) Or _
        (CurrentPoint.Y < Or CurrentPoint.Y > + ListView2.Height) Then
        captured = False
    End If