Function Reference


_GUIToolTip_DelTool

Deletes a tool from a tooltip control

#include <GuiToolTip.au3>
_GUIToolTip_DelTool ( $hTool, $hWnd [, $iID = 0] )

Parameters

$hTool Handle to the ToolTip control (returned by _GUIToolTip_Create.)
$hWnd Handle to the window that contains the tool (see Remarks)
$iID [optional] Handle of the tool to delete (see Remarks)

Return Value

See remark about @error.

Remarks

If $hTool referenced control is not in the same process and both processes run in different AutoIt mode (@AutoItVersion), the @error is set to 6.

Use the same parameters for $hWnd and $iID that were used to create the tool using _GUIToolTip_AddTool()

Related

_GUIToolTip_AddTool

Example

Example 1

#include "Extras\HelpFileInternals.au3"

#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("ToolTip Del Tool v(" & @AutoItVersion & ")", 450, 300, 100, 100)

    ; create a tooltip control using default settings
    Local $hTooltip = _GUIToolTip_Create(0)
    _MemoSetHandleInProcess($hTooltip)

    Local $idButton = GUICtrlCreateButton("Click to Delete Tool", 30, 32, 130, 28)
    Local $hButton = GUICtrlGetHandle($idButton)

    _GUIToolTip_SetMaxTipWidth($hTooltip, 400)

;~  $hGUI = 0 ; is OK
    ; add a tool to the tooltip control
    _GUIToolTip_AddTool($hTooltip, $hGUI, "Click this to delete the tooltip" & @CRLF & "for this button", $hButton)
    _GUIToolTip_AddTool($hTooltip, $hGUI, "ToolTip text for the GUI", $hGUI)

    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton
                ; Deletes the tooltip assigned to the button,
                ; but not the tooltip control for the GUI
                _GUIToolTip_DelTool($hTooltip, $hGUI, $hButton)
                _MemoMsgBox($MB_SYSTEMMODAL, "Tool count", "Number of tools:" & @TAB & _GUIToolTip_GetToolCount($hToolTip))
        EndSwitch
    WEnd

    ; Destroy the tooltip control
    _MemoResetHandleInProcess($hTooltip)
    _GUIToolTip_Destroy($hTooltip)
    GUIDelete($hGUI)
EndFunc   ;==>Example

Example (OutProcess) : ToolTip DelTool to an External process

#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", 2, $sFromTo)

    Local $hToolTip = _MemoGetHandleInProcess()
    Local $hButton = _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo)

    _MemoWrite(">>> Before _GUIToolTip_DelTool() ToolCount = " & _GUIToolTip_GetToolCount($hToolTip))
    _GUIToolTip_DelTool($hToolTip, $hWin, $hButton)
    If @error Then
        _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_DelTool()" & " @error = " & @error & @CRLF & _
                @TAB & "cannot be enumerated from an external process" & @CRLF & _
                @TAB & "running in different mode")
    Else
        ; should not occur if run in different mode
        _MemoWrite(">>> _GUIToolTip_GetToolCount() = " & _GUIToolTip_GetToolCount($hToolTip))
        ; GetToolCount returns 1, but tools are numbered starting from zero (0), so we have to subtract 1
        For $I = 0 To _GUIToolTip_GetToolCount($hToolTip) - 1
            Local $aTool = _GUIToolTip_EnumTools($hToolTip, $I)
            ; only working if both processes are running in "same mode"
            _MemoWrite(">>> Tooltip info for tooltip - " & $I & @CRLF & _
                    "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
                    "HWnd: " & @TAB & "0x" & Hex($aTool[1]) & @CRLF & _
                    "ID: " & @TAB & "0x" & Hex($aTool[2]) & @CRLF & _
                    "Left X:" & @TAB & $aTool[3] & @CRLF & _
                    "Left Y:" & @TAB & $aTool[4] & @CRLF & _
                    "Right X:" & @TAB & $aTool[5] & @CRLF & _
                    "Right Y:" & @TAB & $aTool[6] & @CRLF & _
                    "Instance:" & @TAB & $aTool[7] & @CRLF & _
                    "Text:" & @TAB & $aTool[8] & @CRLF & _
                    "lParam:" & @TAB & $aTool[9])
        Next
    EndIf

    _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI

EndFunc   ;==>Example