I can't find anything on this forum about the LVM_GETTOOLTIPS
Can anyone please post a working example using this to get the tool tip text of listview items??
T.I.A
Printable View
I can't find anything on this forum about the LVM_GETTOOLTIPS
Can anyone please post a working example using this to get the tool tip text of listview items??
T.I.A
Here are some:
http://msdn.microsoft.com/library/de...ettooltips.asp
Here is a Delphi example (you didn't specify the language you wanted the example to be in) that doesn't look like it would be too difficult to translate:
http://cc.borland.com/Item.aspx?id=13988
http://www.vbaccelerator.com/home/VB...stView_bas.asp
Sorry, Im working in vb.
Ok the first link I had already checked out, this returns the handle of the tooltips.
2nd link is over my ahead, I don't know delphi but I can't see anywhere in that 6/7 lines of code where it pulls out the tooltip text.
3rd, again over my head, all I can find in that code is
Public Const LVM_GETTOOLTIPS = (LVM_FIRST + 78)
'public const ListView_GetToolTips(hwndLV)\
' (HWND)SendMessage((hwndLV), LVM_GETTOOLTIPS, 0, 0)
A vb example of getting the tooltip text of a listview item in another program would be great.
To retrieve the text of a tooltip you can use the TTM_GETTEXT method.
Here's a VB6 sample that I knocked up - untested but it might work :p
VB Code:
Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Type TOOLINFO cbSize As Long uFlags As Long hWnd As Long uId As Long rect As RECT hInst As Long lpszText As Long End Type Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageW" ( _ ByVal hWnd As Long, _ ByVal uMsg As Long, _ ByVal wParam As Long, _ ByRef lParam As Any _ ) As Long Const TTM_GETTEXT As Long = &H438 ' get tooltip text from handle Function GetTooltipText(ByVal hWnd As Long, ByVal hTooltip As Long) As String Dim ti As TOOLINFO, buffer As String ti.cbSize = Len(ti) ti.hWnd = hTooltip buffer = Space$(255) ti.lpszText = StrPtr(buffer) SendMessage hWnd, TTM_GETTEXT, 0, ti GetTooltipText = Trim$(buffer) End Function
Thanks for the reply.
VB Code:
Type rect Left As Long Top As Long Right As Long Bottom As Long End Type Type TOOLINFO cbSize As Long uFlags As Long hWnd As Long uId As Long rect As rect hInst As Long lpszText As Long End Type Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageW" ( _ ByVal hWnd As Long, _ ByVal uMsg As Long, _ ByVal wParam As Long, _ ByRef lParam As Any _ ) As Long Const TTM_GETTEXT As Long = &H438 Const LVM_FIRST = &H1000 Const LVM_GETTOOLTIPS = (LVM_FIRST + 78) Sub test() Dim hwnd1 As Long, hwnd2 As Long Dim Str As String hwnd1 = 65790 ' 263244 '65790 hwnd2 = SendMessage(hwnd1, LVM_GETTOOLTIPS, 0, 0) Str = GetTooltipText(hwnd1, hwnd2) MsgBox Str End Sub ' get tooltip text from handle Function GetTooltipText(ByVal hWnd As Long, ByVal hTooltip As Long) As String Dim ti As TOOLINFO, buffer As String ti.cbSize = Len(ti) ti.hWnd = hTooltip buffer = Space$(255) ti.lpszText = StrPtr(buffer) SendMessage hWnd, TTM_GETTEXT, 0, ti GetTooltipText = Trim$(buffer) End Function
It just returns null string for me, I tried on a vb app listview and another programs, nothing.
Strange. I tried it too, don't know why it doesn't work...
Ah ok well thanks for the effort, hopefully someone will figure it out.
Anyone else?
This is the same problem you had getting the listview item text. If the tooltip is in another process you have to marshal the data between processes using the methods shown to you earlier.
Hi moeur using your code (get listview item without the dll) I tried a few things but can't do it, its way over my head. I don't even know what to do with the tooptips hwnd