# Function Reference

# _GUICtrlTab_Destroy

Delete the control

#include <GuiTab.au3>
_GUICtrlTab_Destroy ( ByRef $hWnd )

## Parameters

$hWnd | Control ID/Handle to the control

## Return Value

Success: | True, $hWnd is set to 0.
Failure: | False.
@error: | 1 - Not Allowed to Destroy Other Applications Control(s). 2 - $hWnd is not tab control.

## Remarks

Restricted to only be used on Tab controls created with _GUICtrlTab_Create().

## Related

_GUICtrlTab_Create

## Example

### Example 1

    #include "Extras\HelpFileInternals.au3"

    #include <GUIConstantsEx.au3>
    #include <GuiTab.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Tab Destroy - v(" & @AutoItVersion & ")", 450, 300, 100, 100)
        Local $hTab = _GUICtrlTab_Create($hGUI, 2, 2, 446, 266)
        _MemoMsgBoxStatus() ; Status creation

        GUISetState(@SW_SHOW)

        ; Add tabs
        _GUICtrlTab_InsertItem($hTab, 0, "Tab 0")
        _GUICtrlTab_InsertItem($hTab, 1, "Tab 1")
        _GUICtrlTab_InsertItem($hTab, 2, "Tab 2")

        _MemoMsgBox($MB_SYSTEMMODAL, "Information", "Destroy all Tabs")
        _GUICtrlTab_Destroy($hTab)

        _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

    EndFunc   ;==>Example

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

    #include "Extras\HelpFileInternals.au3"

    #include <GuiTab.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        Local $sFromTo
        Local $hWin = _MemoRunAU3OutProcess($sFromTo, False, "_GUICtrlTab_Create")
        Local $hTabCtrl = _MemoCreateOutProcess($hWin, "SysTabControl32", 2, $sFromTo)

        _GUICtrlTab_Destroy($hTabCtrl)

        If @error Then _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "@error=" & @error & " _GUICtrlTab_Destroy()" & @CRLF & @TAB & "cannot be used for an external process")

        _MemoMsgBoxStatus("", -1, $hWin) ; no more action, wait GUI for closing

    EndFunc   ;==>Example