Retrieves the text of a tool
#include <GuiToolTip.au3>
_GUIToolTip_GetText ( $hTool, $hWnd, $iID )
$hTool | Handle to the ToolTip control (returned by _GUIToolTip_Create.) |
$hWnd | Handle to the window that contains the tool |
$iID | Identifier of the tool, or Window handle of the control the tool is assigned to |
Success: | the text of the specified tool. On non-AutoIt created ToolTips it only retrieves the first 42 characters of the text of the specified tool. |
Failure: | set @error (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.
#include "Extras\HelpFileInternals.au3"
#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $hGUI = GUICreate("ToolTip Get Text v(" & @AutoItVersion & ")", 450, 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
_GUIToolTip_AddTool($hToolTip, $hGUI, "This is the ToolTip text", $hButton)
GUISetState(@SW_SHOW)
; Show the tooltip associated with the button
Opt("MouseCoordMode", 2)
MouseMove(50, 42, 0)
Sleep(250)
; Retrieve the text of the tool
_MemoMsgBox($MB_SYSTEMMODAL, 'Tooltip Text =', _GUIToolTip_GetText($hToolTip, $hGUI, $hButton))
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 Local $hButton = _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo) Local $hToolTip = _MemoGetHandleInProcess() ; Retrieve the text of the tool Local $sText = _GUIToolTip_GetText($hToolTip, $hWin, $hButton) If @error Then _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_GetText()" & " @error = " & @error & @CRLF & _ @TAB & "cannot be accessed by an external process" & @CRLF & _ @TAB & "running in different mode") Else ; only working if both processes are running in "same mode" _MemoWrite('Info' & $sFromTo & @CRLF & $sText) EndIf _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI EndFunc ;==>Example