Code:
Private Declare Function LBItemFromPt Lib "comctl32.dll" (ByVal hLB As Long, ByVal ptx As Long, ByVal pty As Long, ByVal bAutoScroll As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Load()
For i = 0 To 10
List1.AddItem "Number" & i
Next i
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim nPos As Integer
Dim PT As POINTAPI
GetCursorPos PT
nPos = LBItemFromPt(List1.hWnd, PT.X, PT.Y, 0)
List1.Selected(nPos) = True
End Sub