Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _ hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _ lParam As Any) As Long Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As _ Any, dest As Any, ByVal numBytes As Long) Const LB_ITEMFROMPOINT = &H1A9
Function ListBoxItemFromPoint(lb As ListBox, ByVal X As Long, _ ByVal Y As Long) As Long Dim lParam As Long
lParam = X CopyMemory ByVal VarPtr(lParam) + 2, Y, 2
ListBoxItemFromPoint = SendMessage(lb.hwnd, LB_ITEMFROMPOINT, 0, _ ByVal lParam) End Function |