Jump to content

Retrieve Tooltip size ?


Recommended Posts

Hi everybody :)
I display a tooltip using the native command ToolTip("text", ...)
Then the "AutoIt Window Info utility" shows this :

Tooltip.png.393518a39a147787d19136d92d3a663a.png

Is it possible to get the size coords in a script ? (163, 18 in the precedent pic)
The only thing I can retrieve is the handle of the tooltip, with this code placed immediately after the Tooltip() command :

Local $aTooltip = WinList("[CLASS:tooltips_class32]")
If IsArray($aTooltip) And $aTooltip[0][0] <> 0 Then
    ConsoleWrite($aTooltip[1][0] & "   " & $aTooltip[1][1] & @lf)
EndIf

It will display the tooltip text + its handle (3 mousewheel => 3 tooltips, each mousewheel resizing the same pic)

454 / 454  -->  590 / 590   0x001D08E8
454 / 454  -->  580 / 580   0x001F08E8
454 / 454  -->  560 / 560   0x002108E8

How to retrieve the size of a native tooltip when you only got its handle ?
Thanks

Link to comment
Share on other sites

  • 4 weeks later...

Here is a little script showing the detailed infos of a tooltip, maybe it could be useful to a user in need.

#include <MsgBoxConstants.au3>
#include <WinAPISysWin.au3>

ToolTip("Text of this Tooltip ", @DesktopWidth / 2, 280, "", 0, 2)
Local $aToolTip = WinList("[CLASS:tooltips_class32]")

If IsArray($aToolTip) And $aToolTip[0][0] <> 0 Then
    Local $aTag = _WinAPI_GetWindowRect($aTooltip[1][1]) ; thx Nine
    Msgbox($MB_TOPMOST, "Infos about this ToolTip", _
        "Win Title" & @TAB & " : " & $aTooltip[1][0] & @CRLF & _
        "Handle"    & @TAB & " : " & $aTooltip[1][1] & @CRLF & _
        "Left"      & @TAB & " : " & DllStructGetData($aTag, "Left")   & @CRLF & _
        "Top"       & @TAB & " : " & DllStructGetData($aTag, "Top")    & @CRLF & _
        "Right"     & @TAB & " : " & DllStructGetData($aTag, "Right")  & @CRLF & _
        "Bottom"    & @TAB & " : " & DllStructGetData($aTag, "Bottom") & @CRLF)
Else
    Msgbox($MB_TOPMOST, "Infos about this ToolTip", "No infos... something went wrong")
EndIf

ToolTip("")

1849877649_tooltipinfos.png.307eda67e836884d7f4797eaac65c681.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...