本帖最后由 afan 于 2012-6-11 22:05 编辑
回复 20# 131738
那样似乎并不准确,这样试试:#include <GuiListView.au3>
#include <GuiImageList.au3>
Local $imagefile = @SystemDir & '\shell32.dll'
Local $hGui = GUICreate('', 560, 280)
Local $iListView = GUICtrlCreateListView('', 5, 5, 550, 270)
_GUICtrlListView_SetView($iListView, 1)
Local $PicID = 0
Local $hIconImage = _GUIImageList_Create(32, 32, 5, 3)
_GUICtrlListView_SetImageList($iListView, $hIconImage, 0)
Local $vTotal = _WinAPI_ExtractIconEx($imagefile, -1, 0, 0, 0), $vTotalBak = $vTotal
Local $ts = TimerInit()
While $vTotal
_GUIImageList_AddIcon($hIconImage, $imagefile, $PicID, 1)
_GUICtrlListView_AddItem($iListView, $PicID, $PicID)
$vTotal -= 1
$PicID += 1
Wend
Local $te = Round(TimerDiff($ts))
WinSetTitle($hGui, '', '包含图标数量:' & $vTotalBak & '; 耗时:' & $te & ' 毫秒。')
GUISetState()
While GUIGetMsg() + 3
WEnd
或者#include <GuiListView.au3>
#include <GuiImageList.au3>
Local $imagefile = @SystemDir & '\shell32.dll'
Local $hGui = GUICreate('', 560, 280)
Local $iListView = GUICtrlCreateListView('', 5, 5, 550, 270)
_GUICtrlListView_SetView($iListView, 1)
Local $hIconImage = _GUIImageList_Create(32, 32, 5, 3)
_GUICtrlListView_SetImageList($iListView, $hIconImage, 0)
Local $vTotal = _WinAPI_ExtractIconEx($imagefile, -1, 0, 0, 0), $vTotalBak = $vTotal, $PicID
Local $ts = TimerInit()
For $PicID = 0 To $vTotal - 1
_GUIImageList_AddIcon($hIconImage, $imagefile, $PicID, 1)
_GUICtrlListView_AddItem($iListView, $PicID, $PicID)
Next
Local $te = Round(TimerDiff($ts))
WinSetTitle($hGui, '', '包含图标数量:' & $vTotalBak & '; 耗时:' & $te & ' 毫秒。')
GUISetState()
While GUIGetMsg() + 3
WEnd
|