加上UPDATA减少GUI绘制时的资源占用率.
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include<file.au3>
#include<array.au3>
#Include <GuiListView.au3>
$Form1_1 = GUICreate(" ", 587, 572);
$listview1=GUICtrlCreateListView("序号|路径",50,50,400,400)
$buton1=GUICtrlCreateButton("添加",450,450,50,50)
$lable=GUICtrlCreateLabel("",250,500,200,50)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $buton1
open()
EndSwitch
WEnd
Func open()
if FileExists("aa.txt") then FileDelete("aa.txt")
RunWait(@ComSpec & " /c " & "dir c:\*.* /s/b >aa.txt")
local $temp
_FileReadToArray("aa.txt",$temp)
GUICtrlSetData($lable,"一共有"&$temp[0]&"个文件"&@crlf&"生成LISTVIEW中,请等待....")
GUICtrlSetBkColor($lable,0xff0000)
GUICtrlSetState($buton1,$gui_disable)
_GUICtrlListView_BeginUpdate($ListView1)
For $i = 1 To $temp[0]
_GUICtrlListView_AddItem($ListView1, $i, 0)
_GUICtrlListView_AddSubItem($ListView1, $i-1,$temp[$i], 1)
Next
_GUICtrlListView_EndUpdate($ListView1)
GUICtrlSetState($buton1,$gui_Enable)
EndFunc
|