#include <GUIConstantsEx.au3>
#include <Array.au3>

Global $hchildSek[10]
Global $cache

$Form1 = GUICreate("Form1", 301, 454, 192, 124)
$TreeView1 = GUICtrlCreateTreeView(8, 216, 281, 169)

$var = IniReadSectionNames(@ScriptDir & "\test.ini")
If @error Then
    MsgBox(4096, "", "Kein INI File")
Else
    For $i = 1 To $var[0]
        $hchildSek[$i] = GUICtrlCreateTreeViewItem($var[$i], $TreeView1)

        Dim $cache[0][2]

        $var2 = IniReadSection(@ScriptDir & "\test.ini", $var[$i])
        If Not @error Then
            For $j = 1 To $var2[0][0]
                $search = _ArraySearch($cache, $var2[$j][0])
                If $search <> -1 Then
                    GUICtrlCreateTreeViewItem($var2[$j][1], $cache[$search][1])
                Else
                    Local $2Ebene = GUICtrlCreateTreeViewItem($var2[$j][0], $hchildSek[$i])
                    GUICtrlCreateTreeViewItem($var2[$j][1], $2Ebene)
                    _ArrayAdd($cache, $var2[$j][0] & "|" & $2Ebene)
                EndIf
            Next
        EndIf
    Next
EndIf
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
