Function Reference


_GUICtrlTreeView_Destroy

Delete the control

#include <GuiTreeView.au3>
_GUICtrlTreeView_Destroy ( ByRef $hWnd )

Parameters

$hWnd Control ID/Handle to the control

Return Value

Success: True, Handle is set to 0.
Failure: False.

Remarks

Restricted to only be used on TreeView controls created with _GUICtrlTreeView_Create()

Related

_GUICtrlTreeView_Create

Example

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
        Local $hGUI = GUICreate("(UDF Created) TreeView Destroy (v" & @AutoItVersion & ")", 400, 300)

        Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
        Local $hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
        GUISetState(@SW_SHOW)

        _GUICtrlTreeView_BeginUpdate($hTreeView)
        Local $hItem
        For $x = 0 To Random(2, 10, 1)
                $hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
                For $y = 0 To Random(2, 10, 1)
                        _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
                Next
        Next
        _GUICtrlTreeView_EndUpdate($hTreeView)

        MsgBox($MB_SYSTEMMODAL, "Information", "Destroy TreeView Control")
        _GUICtrlTreeView_Destroy($hTreeView)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example