# Function Reference

# _GUIToolTip_Destroy

Delete a ToolTip control

#include <GuiToolTip.au3>
_GUIToolTip_Destroy ( ByRef $hTool )

## Parameters

$hTool | Handle to the ToolTip control (returned by _GUIToolTip_Create.)

## Return Value

Success: | True, $hWnd is set to 0.
Failure: | False, and @error set to 1 - Not Allowed to Destroy Other Applications' Control(s) 2 - $hWnd Not a Tooltip Control Handle

## Remarks

Restricted to only be used on ToolTip controls created with _GUIToolTip_Create.

## Related

_GUIToolTip_Create

## Example

### Example 1

    #include "Extras\HelpFileInternals.au3"

    #include <GUIConstantsEx.au3>
    #include <GuiToolTip.au3>

    ; Click the button to destroy the tooltip control
    Example()

    Func Example()
        Local $hGUI = GUICreate("ToolTip Destroy - 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 Destroy", 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)
        _GUIToolTip_AddTool($hToolTip, $hGUI, "ToolTip text for the GUI", $hGUI)

        GUISetState(@SW_SHOW)

        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $idButton
                    ; Destroys the tooltip control
                    _GUIToolTip_Destroy($hToolTip)
                    _MemoMsgBox($MB_SYSTEMMODAL, "Tool count", "Number of tools:" & @TAB & _GUIToolTip_GetToolCount($hToolTip))
            EndSwitch
        WEnd

        ; Destroy the tooltip control (in case the button hasn't been actioned yet)
        _GUIToolTip_Destroy($hToolTip)
        GUIDelete($hGUI)
    EndFunc   ;==>Example

### Example (OutProcess) : ToolTip Destroy to an External process

    #include "Extras\HelpFileInternals.au3"

    #include <GUIToolTip.au3>

    Example()

    Func Example()
        Local $sFromTo
        Local $hWin = _MemoRunAU3OutProcess($sFromTo, True)
        _MemoCreateOutProcess($hWin, "Button", 0, $sFromTo)

        Local $hToolTip = _MemoGetHandleInProcess()
        _GUIToolTip_Destroy($hToolTip)
        If @error Then
            _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_Destroy()" & " @error = " & @error & @CRLF & _
                    @TAB & "cannot be distroyed in an external process")
        Else
            ; should not occur
            _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