Try the code below. I changed around a few things & cleaned it up somewhat (removed variables that weren't being used etc.) so I could understand what you were doing. Hope you don't mind. java script:emoticon('', 'smid_8')
smilie
Your main problem was that you were trying to use a local variable "$x" (now $i_SectionIndex) from the _IniGetSectionNames() function in the _IniReadInfo() function. The _IniReadInfo() function doesn't know anything about this variable & creates it on 1st use & assigns a null value to it. So nothing was being added to the treeview because of it.
I also changed the "kpu-24" entry to the name of each section name by replacing it with $varx[$i_SectionIndex]. This seems to be more informative as far as the displaying of the .INI file is concerned.
HTH
Dragonrider
Here's the code.
#include <GuiConstants.au3>
#include <file.au3>
#include <array.au3>
Dim $msg = ""
Dim $file = "logfile1.ini"
Dim $TreeView = _CreateGUI()
_IniGetSectionNames( $file, $TreeView )
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;
EndSelect
WEnd
Exit
Func _IniGetSectionNames( $file, $TreeView )
Local $varx = IniReadSectionNames( $file )
If @error Then
Local $RetCode = MsgBox(5000, "", "Error occured, probably no INI file.")
If( $RetCode = 6 ) Then
Exit()
EndIf
Else
For $i_SectionIndex = 1 To $varx[0]
MsgBox(4096, "", $varx[$i_SectionIndex])
_IniReadInfo( $file, $varx, $TreeView, $i_SectionIndex )
Next
EndIf
EndFunc
Func _IniReadInfo( $file, $varx, $TreeView, $i_SectionIndex )
;MsgBox(32,"VarX","Varx = " & $varx[$i_SectionIndex])
Local $TreeView2 = GUICtrlCreateTreeViewitem($varx[$i_SectionIndex],$TreeView )
Local $var = IniReadSection($file,$varx[$i_SectionIndex])
If @error Then
; MsgBox(4096, "", "Error occured, probably no INI file.")
Return
Else
For $i = 1 To $var[0][0]
GUICtrlCreateTreeViewItem($var[$i][0] & " = " & $var[$i][1], $TreeView2)
MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF );& "Value: " & $var[$i][1])
Next
EndIf
EndFunc
Func _CreateGUI()
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("Form2", 420, 331, 430,346 ,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
Return GUICtrlCreateTreeView(16, 16, 353, 217)
EndFuncTreeview_From_INI.au3