Returns the width and height of a ToolTip control
#include <GuiToolTip.au3>
_GUIToolTip_GetBubbleSize ( $hTool, $hWnd, $iID [, $iFlags = Default] )
$hTool | Handle to the ToolTip control (returned by _GUIToolTip_Create.) |
$hWnd | 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 Default = BitOr($TTF_SUBCLASS, $TTF_IDISHWND) |
Success: | the width of the ToolTip in the low word and the height in the high word. |
Failure: | @error is set (see remark). |
If $hWnd referenced control is not in the same process and both processes run in different AutoIt mode (@AutoItVersion), the @error is set to 6.
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 "Extras\HelpFileInternals.au3"
#include <GUIConstantsEx.au3>
#include <GuiToolTip.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $hGUI = GUICreate("ToolTip Get Bubble Size/Height/Width v(" & @AutoItVersion & ")", 430, 300, 100, 100)
; create a tooltip control using default settings
Local $hToolTip = _GUIToolTip_Create(0)
_MemoSetHandleInProcess($hToolTip)
Local $idButton = GUICtrlCreateButton("Button", 30, 32, 130, 28)
Local $hButton = GUICtrlGetHandle($idButton)
;~ $hGUI = 0 ; is OK
; add a tool to the tooltip control
_GUIToolTip_AddTool($hToolTip, $hGUI, "This is a ToolTip", $hButton)
GUISetState(@SW_SHOW)
; Show the tooltip associated with the button
Opt("MouseCoordMode", 2)
MouseMove(50, 42, 0)
Sleep(250)
Local $iSize = _GUIToolTip_GetBubbleSize($hToolTip, $hGUI, $hButton)
Local $iBubbleHeight = _GUIToolTip_GetBubbleHeight($hToolTip, $hGUI, $hButton)
Local $iBubbleWidth = _GUIToolTip_GetBubbleWidth($hToolTip, $hGUI, $hButton)
; Display the height of the tooltip bubble in pixels
_MemoMsgBox($MB_SYSTEMMODAL, "Information", "Bubble Size = " & @TAB & "0x" & Hex($iSize) & @CRLF & _
"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
_MemoResetHandleInProcess($hTooltip)
_GUIToolTip_Destroy($hToolTip)
GUIDelete($hGUI)
EndFunc ;==>Example
#include "Extras\HelpFileInternals.au3" #include <GUIToolTip.au3> Example() Func Example() Local $sFromTo Local $hWin = _MemoRunAU3OutProcess($sFromTo, True) ; OK same mode, KO if different mode _MemoCreateOutProcess($hWin, "Button", 1, $sFromTo) Local $hToolTip = _MemoGetHandleInProcess() Local $hButton = _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo) Local $iSize = _GUIToolTip_GetBubbleSize($hToolTip, $hWin, $hButton) Local $iBubbleHeight = _GUIToolTip_GetBubbleHeight($hToolTip, $hWin, $hButton) Local $iBubbleWidth = _GUIToolTip_GetBubbleWidth($hToolTip, $hWin, $hButton) If @error Then _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_GetBubbleSize()" & " @error = " & @error & @CRLF & _ @TAB & "cannot be enumerated from an external process" & @CRLF & _ @TAB & "running in different mode") Else ; Display the height of the tooltip bubble in pixels _MemoMsgBox($MB_SYSTEMMODAL, "Information", "Bubble Size = " & @TAB & "0x" & Hex($iSize) & @CRLF & _ "Bubble Height = " & @TAB & $iBubbleHeight & " " & " Pixels" & @CRLF & _ "Bubble Width = " & @TAB & $iBubbleWidth & " Pixels") EndIf _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI EndFunc ;==>Example