Results 1 to 10 of 10

Thread: Lvm_gettooltips

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    205

    Lvm_gettooltips

    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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Lvm_gettooltips

    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    205

    Re: Lvm_gettooltips

    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.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Lvm_gettooltips

    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
    VB Code:
    1. Type RECT
    2.     Left    As Long
    3.     Top     As Long
    4.     Right   As Long
    5.     Bottom  As Long
    6. End Type
    7.  
    8. Type TOOLINFO
    9.     cbSize  As Long
    10.     uFlags  As Long
    11.     hWnd    As Long
    12.     uId     As Long
    13.     rect    As RECT
    14.     hInst   As Long
    15.     lpszText As Long
    16. End Type
    17.  
    18. Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageW" ( _
    19.     ByVal hWnd As Long, _
    20.     ByVal uMsg As Long, _
    21.     ByVal wParam As Long, _
    22.     ByRef lParam As Any _
    23. ) As Long
    24.  
    25. Const TTM_GETTEXT As Long = &H438
    26.  
    27. ' get tooltip text from handle
    28. Function GetTooltipText(ByVal hWnd As Long, ByVal hTooltip As Long) As String
    29.     Dim ti As TOOLINFO, buffer As String
    30.     ti.cbSize = Len(ti)
    31.     ti.hWnd = hTooltip
    32.     buffer = Space$(255)
    33.     ti.lpszText = StrPtr(buffer)
    34.     SendMessage hWnd, TTM_GETTEXT, 0, ti
    35.     GetTooltipText = Trim$(buffer)
    36. End Function

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    205

    Re: Lvm_gettooltips

    Thanks for the reply.

    VB Code:
    1. Type rect
    2.     Left    As Long
    3.     Top     As Long
    4.     Right   As Long
    5.     Bottom  As Long
    6. End Type
    7.  
    8. Type TOOLINFO
    9.     cbSize  As Long
    10.     uFlags  As Long
    11.     hWnd    As Long
    12.     uId     As Long
    13.     rect    As rect
    14.     hInst   As Long
    15.     lpszText As Long
    16. End Type
    17.  
    18. Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageW" ( _
    19.     ByVal hWnd As Long, _
    20.     ByVal uMsg As Long, _
    21.     ByVal wParam As Long, _
    22.     ByRef lParam As Any _
    23. ) As Long
    24.  
    25. Const TTM_GETTEXT As Long = &H438
    26. Const LVM_FIRST = &H1000
    27. Const LVM_GETTOOLTIPS = (LVM_FIRST + 78)
    28.  
    29. Sub test()
    30. Dim hwnd1 As Long, hwnd2 As Long
    31. Dim Str As String
    32.  
    33. hwnd1 = 65790 ' 263244  '65790
    34. hwnd2 = SendMessage(hwnd1, LVM_GETTOOLTIPS, 0, 0)
    35.  
    36.  
    37.  
    38.  Str = GetTooltipText(hwnd1, hwnd2)
    39. MsgBox Str
    40. End Sub
    41. ' get tooltip text from handle
    42. Function GetTooltipText(ByVal hWnd As Long, ByVal hTooltip As Long) As String
    43.     Dim ti As TOOLINFO, buffer As String
    44.     ti.cbSize = Len(ti)
    45.     ti.hWnd = hTooltip
    46.     buffer = Space$(255)
    47.     ti.lpszText = StrPtr(buffer)
    48.  
    49.     SendMessage hWnd, TTM_GETTEXT, 0, ti
    50.     GetTooltipText = Trim$(buffer)
    51. End Function


    It just returns null string for me, I tried on a vb app listview and another programs, nothing.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Lvm_gettooltips

    Strange. I tried it too, don't know why it doesn't work...

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    205

    Re: Lvm_gettooltips

    Ah ok well thanks for the effort, hopefully someone will figure it out.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    205

    Re: Lvm_gettooltips

    Anyone else?

  9. #9
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Lvm_gettooltips

    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.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    205

    Re: Lvm_gettooltips

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width