本帖最后由 jinyue115 于 2011-7-29 14:52 编辑 #include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <file.au3>
#include <array.au3>
$GUI = GUICreate("(UDF Created) TreeView Create", 400, 640)
$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 568);,$iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_BeginUpdate($hTreeView)
;==========================================================================
TreeViewList()
;==========================================================================
_GUICtrlTreeView_EndUpdate($hTreeView)
GUISetState()
Do
Until GUIGetMsg()=-3
Func TreeViewList()
$filelist = _FileListToArray(@ProgramFilesDir)
If @error =1 then Exit
If UBound ($filelist) <> '' Then
For $i = 1 To $filelist[0]
$hitem=_GUICtrlTreeView_Add($hTreeView,0,$filelist[$i])
If StringInStr(Filegetattrib(@ProgramFilesDir & '\' & $filelist[$i]),'D') Then
$filelistb = _FileListToArray(@ProgramFilesDir & '\' & $filelist[$i])
If UBound ($filelistb) <> '' Then
For $j = 1 To $filelistb[0]
If StringInStr(FileGetAttrib(@ProgramFilesDir & '\' & $filelist[$i] & '\' & $filelistb[$j] ),'D') Then
$hChildItem = _GUICtrlTreeView_AddChild($hTreeView,$hitem,$filelistb[$j])
$hchildchilditem = _GUICtrlTreeView_AddChild($hTreeView,$hChildItem,$filelistb[$j])
$filelistc = _FileListToArray(@ProgramFilesDir & '\' & $filelist[$i] & '\' & $filelistb[$j])
If UBound ($filelistc) <> '' Then
For $k =1 To $filelistc[0]
_GUICtrlTreeView_AddChild($hTreeView ,$hchildchilditem,$filelistc[$k])
Next
EndIf
;~ TreeViewList()
Else
$hChildItem = _GUICtrlTreeView_AddChild($hTreeView,$hitem,$filelistb[$j])
EndIf
Next
EndIf
EndIf
Next
EndIf
EndFunc
为什么不能回复了? |