本帖最后由 afan 于 2010-2-4 17:28 编辑
回复 18# sanmoking
很简单啊老大~#include <GUIListView.au3>
#include <GUIImageList.au3>
#include <WinAPIEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
Dim $folder = FileSelectFolder('请选择目标文件夹', '', 2, @MyDocumentsDir)
If @error Then Exit (Msgbox(48, '退出', '没有选择文件夹,退出'))
Dim $a = _FileListToArray($folder, '*', 1)
If $a = 0 Then Exit (Msgbox(48, '退出', '没有选择文件夹,退出'))
Dim $Ext
GUICreate('MyIconGUI', 280, 400)
$ListView = GUICtrlCreateListView('', 10, 10, 260, 344, $LVS_NOCOLUMNHEADER)
_GUICtrlListView_InsertColumn($ListView, 0, '', 220)
$hImageList = _GUIImageList_Create(16, 16, 6)
_GUICtrlListView_SetImageList($ListView, $hImageList, 1)
$Button = GUICtrlCreateButton('退出', 105, 361, 70, 23)
For $i = 1 To $a[0]
$Ext = $folder & '\' & $a[$i]
$tSHFILEINFO = _WinAPI_ShellGetFileInfo($Ext, BitOR($SHGFI_ICON, $SHGFI_SMALLICON, $SHGFI_USEFILEATTRIBUTES))
$hIcon = DllStructGetData($tSHFILEINFO, 'hIcon')
_GUIImageList_ReplaceIcon($hImageList, -1, $hIcon)
_GUICtrlListView_AddItem($ListView, $a[$i], $i -1)
_WinAPI_FreeIcon($hIcon)
Next
GUISetState()
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case -3, $Button
ExitLoop
EndSwitch
WEnd
|