PDA

Click to See Complete Forum and Search --> : is there an api call to get tooltip text?


Crypt
Aug 19th, 2000, 05:18 AM
Hiyas,

I was just wondering if there was an api call to actually get the tooltip text of an object on another window when you have the objects hwnd.

any help is appreciated.

thanx.

hitcgar
Aug 28th, 2000, 01:06 PM
once you have a handle to the object you can use the API
to tooltip functions to manipulate it in just about any
way you wish. You can add a tooltip to an object using the
TTM_ADDTOOL message with a CreateWindow call.

Check out this page for examples:

http://msdn.microsoft.com/library/psdk/shellcc/commctls/ToolTip/UsingTooltips.htm

Declare :
Type TOOLINFO
cbSize As Long ' sizeof structure
uFlags As Long ' see TTM_ constants
hwnd As Long ' Handle to the window that contains the tool
uId As Long ' uId must specify the window handle to the tool
r As RECT ' Tool's bounding rectangle coordinates
hinst As Long ' pointer to string resource or null
lpszText As String ' buffer that contains the text
lParam As Long
End Type

fill in the structure

Dim ti as TOOLINFO

After this you can use call like:

SendMessage(hWnd,TTM_ADDTOOL, 0, ti)

to create the tooltip.

To get the values for the TTM_ constants you'll have to sift through the SDK .h files since I don't think they're
available on the ms site.

Hope this helps.

Crypt
Aug 28th, 2000, 04:10 PM
thanx for all the info hitcga :)