<P>列举某文件夹下所有文件,写入C:\1.txt,(论坛某朋友贡献的源码)</P>
<P>我在此之上加了使之显示在edit文本框.</P>
<P>但是会卡在某个地方,C:\1.txt里面是列举完成了的,难道是数量限制吗?</P>
<P> </P>
<P>附上截图及源码</P>#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$AForm1 = GUICreate("AForm1", 633, 451, 193, 125)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 617, 400, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_HSCROLL,$WS_VSCROLL))
$Button1 = GUICtrlCreateButton("Button1", 8, 408, 617, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If FileExists("c:\1.txt") Then FileDelete("c:\1.txt")
Local $fh = FileOpen("c:\1.txt", 2)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
FindAll("F:")
FileClose($fh)
EndSwitch
WEnd
Func FindAll($path)
Local $fpath, $fs, $fa
$fpath = $path & "\*.*"
Local $f = FileFindFirstFile($fpath)
While 1
$fs = FileFindNextFile($f)
If @error Then
FileClose($f)
Return
EndIf
If $fs = "." Or $fs = ".." Then
ContinueLoop
EndIf
$fa = FileGetAttrib($path & "\" & $fs)
If StringInStr($fa, "D") Then
FindAll($path & "\" & $fs)
Else
FileWriteLine($fh, $path & "\" & $fs)
GUICtrlSetData($Edit1,$path & "\" & $fs&@CRLF,1)
EndIf
WEnd
EndFunc
[ 本帖最后由 e5907 于 2008-7-29 08:34 编辑 ] |