venkatraman_r
Dec 1st, 1999, 11:22 AM
Hi,
Recently, I saw a message explaining how to get the tool tip text for a list box item without selecting it. Like what Microsoft had done it in VB Books on line. Can anyone please let me know where it is?
Thanx.
Venkat.
Serge
Dec 1st, 1999, 06:45 PM
Sure thing. Put this on Listbox MouseMove event:
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 Const LB_GETITEMHEIGHT = &H1A1
Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim intItemIndex As Integer
Dim strItem As String
Dim lngItemHeight As Long
'Get the height og the item in the list
lngItemHeight = SendMessage(List1.hwnd, LB_GETITEMHEIGHT, 0, 0)
'Get the index of the item your mouse is over
intItemIndex = List1.TopIndex + (Y \ (lngItemHeight * Screen.TwipsPerPixelY))
If intItemIndex > List1.ListCount - 1 Then Exit Sub
strItem = List1.List(intItemIndex)
List1.ToolTipText = strItem
End Sub
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 12-02-1999).]