|
发表于 2014-6-4 17:53:02
|
显示全部楼层
这样试试看
#include <ButtonConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Global $Form1
GUI()
While 1
Sleep(100)
WEnd
Func GUI()
Local $ini, $htv, $csname = "class", $hClass = 0
$Form1 = GUICreate("treeview", 300, 300)
GUISetOnEvent($GUI_EVENT_CLOSE, "GForm1Close")
$htv = GUICtrlCreateTreeView(0, 0, 150, 300, -1, $WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton("更 新", 216, 208, 67, 25)
GUICtrlSetOnEvent($Button1, "gengxin")
GUISetState(@SW_SHOW)
GUISetState()
readinfo("data.ini", $htv)
EndFunc ;==>GUI
;Do
;Sleep(10)
;Until GUIGetMsg() = -3
Func readinfo($ini, $htv, $csname = "class", $hClass = 0)
If Not $hClass Then $hClass = $htv
$aSec = IniReadSection($ini, $csname)
If @error Then Return False
For $i = 1 To $aSec[0][0]
$child = IniReadSection($ini, $aSec[$i][0])
If @error Then;频道
$hItem = GUICtrlCreateTreeViewItem($aSec[$i][0], $hClass)
Else;子类
$hClass1 = GUICtrlCreateTreeViewItem($aSec[$i][0], $hClass)
readinfo($ini, $hClass, $aSec[$i][0], $hClass1)
EndIf;频道或分类
Next
Return True
EndFunc ;==>readinfo
Func gengxin()
GUISetState(@SW_HIDE, $Form1)
GUISetState(@SW_SHOW, $Form1)
GUI()
EndFunc ;==>gengxin
Func GForm1Close()
Exit
EndFunc ;==>GForm1Close |
|