#include <GUIConstantsEx.au3>
#include <TreeviewConstants.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("ControlTreeview", 212, 212)
$iTreeView_1 = GUICtrlCreateTreeView(6, 6, 200, 160, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE)
$hTreeView_1 = ControlGetHandle($hGUI, "", $iTreeView_1)

$iRoot = GUICtrlCreateTreeViewItem("Корневой", $iTreeView_1)
$item1 = GUICtrlCreateTreeViewItem("Пункт 1", $iRoot)
$item2 = GUICtrlCreateTreeViewItem("Пункт 2", $iRoot)
$item3 = GUICtrlCreateTreeViewItem("Пункт 3", $iRoot)
$iItem_4 = GUICtrlCreateTreeViewItem("Пункт 4", $iRoot)
GUICtrlCreateTreeViewItem("Пункт 4.1", $iItem_4)
GUICtrlCreateTreeViewItem("Пункт 4.2", $iItem_4)
GUICtrlCreateTreeViewItem("Пункт 5", $iRoot)

GUISetState(@SW_SHOW, $hGUI)

; some examples
ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Корневой")

ControlTreeView($hGUI, "", $hTreeView_1, "Exists", "Корневой|Пункт 4")
ControlTreeView($hGUI, "", $hTreeView_1, "Check", "Корневой|Пункт 4")
ControlTreeView($hGUI, "", $hTreeView_1, "Select", "Корневой|Пункт 4")
ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Корневой|Пункт 4")

While 1
	$msg = GUIGetMsg()
	Switch $msg
		Case $GUI_EVENT_CLOSE
			ExitLoop
	EndSwitch
WEnd