Returns the width and height of a ToolTip control
#include <GuiToolTip.au3>
_GUIToolTip_GetBubbleSize ( $hWnd, $hTool, $iID [, $iFlags = 0x00000001 + 0x00000010] )
$hWnd | Handle to the ToolTip control (returned by _GUIToolTip_Create.) |
$hTool | Handle to the window that contains the tool |
$iID | Handle of the control that the tool is associated with, or the ID of the tool |
$iFlags | [optional] Flags that control the ToolTip display $TTF_IDISHWND = Indicates that $iID is the window handle to the tool instead of the ID $TTF_CENTERTIP = Centers the window below the tool specified by $iID $TTF_RTLREADING = Indicates that text will be displayed in the opposite direction $TTF_SUBCLASS = Indicates that the control should subclass the tool's window to intercept messages $TTF_TRACK = Positions the control next to the tool to which it corresponds $TTF_ABSOLUTE = Positions the window at the same coordinates provided by TTM_TRACKPOSITION $TTF_TRANSPARENT = Causes the control to forward mouse messages to the parent window $TTF_PARSELINKS = Indicates that links in the control text should be parsed |
This function works correctly only on a tracking tooltip, if the tracking hasn't been activated for the tooltip you will get incorrect values returned.
_GUIToolTip_GetBubbleHeight, _GUIToolTip_GetBubbleWidth
#include <GUIConstantsEx.au3>
#include <GuiToolTip.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIConv.au3>
Example()
Func Example()
Local $hGUI = GUICreate(StringTrimRight(@ScriptName, StringLen(".exe")), 350, 200)
Local $idButton = GUICtrlCreateButton("This is a button", 30, 32, 130, 28)
Local $hButton = GUICtrlGetHandle($idButton)
; create a tooltip control using default settings
Local $hToolTip = _GUIToolTip_Create(0)
; add a tool to the tooltip control
_GUIToolTip_AddTool($hToolTip, 0, "This is a ToolTip", $hButton)
GUISetState(@SW_SHOW)
_GUIToolTip_TrackActivate($hToolTip, True, 0, $hButton)
Local $iBubbleHeight = _WinAPI_HiWord(_GUIToolTip_GetBubbleSize($hToolTip, 0, $hButton))
Local $iBubbleWidth = _WinAPI_LoWord(_GUIToolTip_GetBubbleSize($hToolTip, 0, $hButton))
; Display the height of the tooltip bubble in pixels
MsgBox($MB_SYSTEMMODAL, "Info", "Bubble Height = " & @TAB & $iBubbleHeight & " Pixels" & @CRLF & _
"Bubble Width = " & @TAB & $iBubbleWidth & " Pixels")
While 1
If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
; Destroy the tooltip control
_GUIToolTip_Destroy($hToolTip)
GUIDelete($hGUI)
EndFunc ;==>Example