本帖最后由 水木子 于 2011-2-19 18:05 编辑
#include <GUIListView.au3>
Opt("GUIOnEventMode", 1)
GUICreate("", 400, 300)
GUISetOnEvent(-3, "_EventResponse")
$ListView1 = GUICtrlCreateListView("|", 5, 5, 390, 250)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 350)
$Button1 = GUICtrlCreateButton("Button1", 312, 260, 75, 25)
GUICtrlSetOnEvent(-1, "_EventResponse")
GUISetState()
While 1
Sleep(100)
WEnd
Func _EventResponse()
Switch @GUI_CtrlId
Case -3
Exit
Case $Button1
$var = FileOpenDialog('', '', '所有文件(*.*)', 1 + 4)
If Not @error Then
$aRe = StringRegExp($var, '(?<=[\\\|])[^\.\\]+\.\w{2,4}', 3)
For $i = 0 To UBound($aRe) - 1
GUICtrlCreateListViewItem($aRe[$i], $ListView1)
Next
EndIf
EndSwitch
EndFunc ;==>_EventResponse
|