Private Sub LstItem_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error GoTo ErrIdx LstItem.ToolTipText = LstItem.List(SendMessage(LstItem.hWnd, LB_ITEMFROMPOINT, 0, ByVal MAKELPARAM(X \ Screen.TwipsPerPixelX, Y \ Screen.TwipsPerPixelY))) Exit Sub
ErrIdx: LstItem.ToolTipText = vbNullString
End Sub
Private Function MAKELPARAM(ByVal low As Integer, ByVal high As Integer) As Long Dim t As Long t = (high And &H7FFF) * &H10000 Or (low And &H7FFF) If high And &H8000 Then t = t Or &H80000000 If low And &H8000 Then t = t Or &H8000 MAKELPARAM = t End Function
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const LB_ITEMFROMPOINT As Long = &H1A9
On Error GoTo ErrIdx
LstItem.ToolTipText = LstItem.List(SendMessage(LstItem.hWnd, LB_ITEMFROMPOINT, 0, ByVal MAKELPARAM(X \ Screen.TwipsPerPixelX, Y \ Screen.TwipsPerPixelY)))
Exit Sub
ErrIdx:
LstItem.ToolTipText = vbNullString
End Sub
Dim t As Long
t = (high And &H7FFF) * &H10000 Or (low And &H7FFF)
If high And &H8000 Then t = t Or &H80000000
If low And &H8000 Then t = t Or &H8000
MAKELPARAM = t
End Function
Private Const LB_ITEMFROMPOINT As Long = &H1A9