|
-
Nov 28th, 2005, 09:13 AM
#1
Thread Starter
Addicted Member
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
-
Nov 28th, 2005, 01:25 PM
#2
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
-
Nov 28th, 2005, 02:45 PM
#3
Thread Starter
Addicted Member
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.
-
Dec 1st, 2005, 07:16 AM
#4
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:
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
-
Dec 1st, 2005, 07:31 AM
#5
Thread Starter
Addicted Member
Re: Lvm_gettooltips
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.
-
Dec 1st, 2005, 07:48 AM
#6
Re: Lvm_gettooltips
Strange. I tried it too, don't know why it doesn't work...
-
Dec 1st, 2005, 01:20 PM
#7
Thread Starter
Addicted Member
Re: Lvm_gettooltips
Ah ok well thanks for the effort, hopefully someone will figure it out.
-
Apr 6th, 2006, 04:19 PM
#8
Thread Starter
Addicted Member
-
Apr 6th, 2006, 07:01 PM
#9
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.
-
Apr 8th, 2006, 06:37 PM
#10
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|