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="http://ipost2host.com/viewtopic.php?f=13&t=2362#" target="_blank">
</a>
Code:
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="http://ipost2host.com/viewtopic.php?f=13&t=2362#" target="_blank">
</a>
Code:
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 < ListView2.top Or CurrentPoint.Y > ListView2.top + ListView2.Height) Then
        ReleaseCapture
        captured = False
    End If