#include <GUIListView.au3>
#include <WindowsConstants.au3>
GUICreate("ListView", 320, 300)
$ListView1 = GUICtrlCreateListView("编号|姓名|ID", 1, 1, 318, 230, -1, _
BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_REPORT))
$anniu1 = GUICtrlCreateButton("获取全部文本", 100, 250, 100, 30)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 100)
_GUICtrlListView_SetColumnWidth($ListView1, 2, 100)
GUISetState(@SW_SHOW)
GUICtrlCreateListViewItem('1|张三|65786315', $ListView1)
GUICtrlCreateListViewItem('2|李四|56454688', $ListView1)
GUICtrlCreateListViewItem('3|王五|86575765', $ListView1)
GUICtrlCreateListViewItem('4|孙六|87654832', $ListView1)
GUICtrlCreateListViewItem('5|赵七|96325478', $ListView1)
GUICtrlCreateListViewItem('6|成八|64651873', $ListView1)
GUICtrlCreateListViewItem('7|冯九|96437251', $ListView1)
GUICtrlCreateListViewItem('8|钱十|64976835', $ListView1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3
Exit
Case $anniu1
Read()
EndSwitch
WEnd
Func Read()
Local $sText
For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
$sText &= _GUICtrlListView_GetItemTextString($ListView1, $i) & @CRLF
Next
MsgBox(64, '全部项目文本', $sText)
$sText = ''
EndFunc ;==>Read
|