#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $hListView, $but
GUICreate("ListView Set Item Checked State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
$but = GUICtrlCreateButton("显示选定行的ID值为...", 30, 275)
GUISetState()
;新增列
_GUICtrlListView_AddColumn($hListView, "ID", 100)
_GUICtrlListView_AddColumn($hListView, "Name", 100)
_GUICtrlListView_AddColumn($hListView, "Age", 100)
;新增项目
_GUICtrlListView_AddItem($hListView, "1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Peter", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "23", 2)
_GUICtrlListView_AddItem($hListView, "2", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Jack", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "26", 2)
_GUICtrlListView_AddItem($hListView, "2", 2)
_GUICtrlListView_AddSubItem($hListView, 2, "Mark", 1)
_GUICtrlListView_AddSubItem($hListView, 2, "33", 2)
While 1
Switch GUIGetMsg()
Case $but
;MsgBox(4160, "", "选中了第 "&_GUICtrlListView_GetSelectedIndices($hlistView)&" 行项目。")
MsgBox(4160, "选中行的第一列的值...", "???")
Case -3
Exit
EndSwitch
WEnd
EndFunc ;==>Example