#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Array.au3>
$iItems = Random(9000, 10000, 1)
$iRows = Random(3, 6, 1)
Dim $aItems[$iItems][$iRows]
For $i = 0 To UBound($aItems) - 1 ;или $iItems - 1
For $j = 0 To UBound($aItems, 2) - 1 ;или $iRows - 1
$aItems[$i][$j] = 'Item ' & $i + 1 & '-' & $j
Next
Next
GUICreate($iItems & 'x' & $iRows, 400, 320)
$nListView = GUICtrlCreateListView('', 2, 2, 394, 268)
$hListView = GUICtrlGetHandle($nListView)
$nButton = GUICtrlCreateButton('Получить', 150, 280, 100, 30)
GUISetState()
For $i = 0 To $iRows - 1
_GUICtrlListView_AddColumn($hListView, 'SubItems ' & $i, 100)
Next
_GUICtrlListView_AddArray($hListView, $aItems)
$aItems = 0
$iItems = 0
$iRows = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $nButton
$iStart = TimerInit()
$iItems = _GUICtrlListView_GetItemCount($hListView)
$iRows = _GUICtrlListView_GetColumnCount($hListView)
Dim $aItems[$iItems][$iRows]
For $i = 0 To $iItems - 1
For $j = 0 To $iRows - 1
$aItems[$i][$j] = _GUICtrlListView_GetItemText($hListView, $i, $j)
Next
Next
$sTime = StringFormat('%.2f msec', TimerDiff($iStart))
_GUICtrlListView_DeleteAllItems($hListView)
_ArrayDisplay($aItems, $sTime)
For $i = 0 To UBound($aItems) - 1
For $j = 0 To UBound($aItems, 2) - 1
$aItems[$i][$j] &= ' - New'
Next
Next
_GUICtrlListView_AddArray($hListView, $aItems)
$sTime = ''
$aItems = 0
$iItems = 0
$iRows = 0
EndSwitch
WEnd
$Count = 10000
$LV = GUICtrlCreateListView(...)
For $i = 1 To $Count
GUICtrlCreateListViewItem(..., $LV)
Next
...
$sData = ''
For $i = $LV + 1 To $LV + $Count
$sData &= GUICtrlRead($i) & ChrW(160)
Next
$aData = StringSplit(StringTrimRight($sData, 1), Chr(160), 2)
#include <GuiConstantsEx.au3>
#include <Array.au3>
$sText = ''
$iItems = Random(9000, 10000, 1)
$iRows = Random(3, 6, 1)
Dim $aItems[$iItems]
For $i = 0 To $iItems - 1
$sText = ''
For $j = 0 To $iRows - 1
$sText &= 'Item ' & $i + 1 & '-' & $j & '|'
Next
$aItems[$i] = StringTrimRight($sText, 1)
Next
$hGui = GUICreate($iItems & 'x' & $iRows, 400, 320)
$sText = ''
For $i = 0 To $iRows - 1
$sText &= 'SubItems ' & $i & '|'
Next
$nListView = GUICtrlCreateListView($sText, 2, 2, 394, 268)
For $i = 1 To $iItems
GUICtrlCreateListViewItem($aItems[$i - 1], $nListView)
Next
$nButton = GUICtrlCreateButton('Получить', 150, 280, 100, 30)
GUISetState()
$sText = ''
$iItems = 0
$iRows = 0
$aItems = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $nButton
$iStart = TimerInit()
$iItems = GUICtrlSendMsg($nListView, 0x1004, 0, 0) ;$LVM_GETITEMCOUNT
$iRows = ControlListView($hGui, '', $nListView, 'GetSubItemCount')
ConsoleWrite($iItems & 'x' & $iRows & @LF)
Dim $aItems[$iItems][$iRows]
For $i = $nListView + 1 To $nListView + $iItems
$sText = GUICtrlRead($i)
$aTemp = StringSplit($sText, '|')
For $j = 1 To $aTemp[0] - 1
$aItems[$i - $nListView - 1][$j - 1] = $aTemp[$j]
Next
Next
$sTime = StringFormat('%.2f msec', TimerDiff($iStart))
_ArrayDisplay($aItems, $sTime)
$sTime = ''
$sText = ''
$iItems = 0
$iRows = 0
$aItems = 0
EndSwitch
WEnd
Это к автору темы.зачем нужен 2D массив?
Не знаю насколько правильно, но так у меня работает быстрее всего.Если создать структуру один раз перед циклом и перейти на DllCall() - SendMessage(), то можно увеличить скорость в 2-3 раза
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Array.au3>
$iItems = 10000;Random(9000, 10000, 1)
$iRows = 3;Random(3, 6, 1)
Dim $aItems[$iItems][$iRows]
For $i = 0 To UBound($aItems) - 1 ;или $iItems - 1
For $j = 0 To UBound($aItems, 2) - 1 ;или $iRows - 1
$aItems[$i][$j] = 'Item ' & $i + 1 & '-' & $j
Next
Next
GUICreate($iItems & 'x' & $iRows, 400, 320)
$nListView = GUICtrlCreateListView('', 2, 2, 394, 268)
$nButton = GUICtrlCreateButton('Получить', 150, 280, 100, 30)
GUISetState()
$iStart = TimerInit()
For $i = 0 To $iRows - 1
_GUICtrlListView_AddColumn($nListView, 'SubItems ' & $i, 100)
Next
_GUICtrlListView_AddArray($nListView, $aItems)
ConsoleWrite(StringFormat('%.2f msec', TimerDiff($iStart)) & @LF)
$aItems = 0
$iItems = 0
$iRows = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $nButton
$iStart = TimerInit()
_GUICtrlListView_BeginUpdate($nListView)
$iItems = _GUICtrlListView_GetItemCount($nListView)
$iRows = _GUICtrlListView_GetColumnCount($nListView)
Dim $aItems[$iItems][$iRows]
$fUnicode = _GUICtrlListView_GetUnicodeFormat($nListView)
If $fUnicode Then
$tBuffer = DllStructCreate('wchar Text[4096]')
Else
$tBuffer = DllStructCreate('char Text[4096]')
EndIf
$pBuffer = DllStructGetPtr($tBuffer)
$tItem = DllStructCreate($tagLVITEM)
$pItem = DllStructGetPtr($tItem)
DllStructSetData($tItem, 'TextMax', 4096)
DllStructSetData($tItem, 'Text', $pBuffer)
For $i = 0 To $iItems - 1
For $j = 0 To $iRows - 1
DllStructSetData($tItem, 'SubItem', $j)
If $fUnicode Then
GUICtrlSendMsg($nListView, $LVM_GETITEMTEXTW, $i, $pItem)
Else
GUICtrlSendMsg($nListView, $LVM_GETITEMTEXTA, $i, $pItem)
EndIf
$aItems[$i][$j] = DllStructGetData($tBuffer, 'Text')
Next
Next
_GUICtrlListView_EndUpdate($nListView)
$sTime = StringFormat('%.2f msec', TimerDiff($iStart))
_ArrayDisplay($aItems, $sTime)
$sTime = ''
$aItems = 0
$iItems = 0
$iRows = 0
$fUnicode = 0
$tBuffer = 0
$pBuffer = 0
$tItem = 0
$pItem = 0
EndSwitch
WEnd