本帖最后由 nmgwddj 于 2010-4-12 03:51 编辑
稍等 我给你整个例子#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("窗体1", 405, 294, 302, 218)
$ListView1 = GUICtrlCreateListView("编号|名称", 16, 16, 369, 201)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 235)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_CHECKBOXES))
$Button1 = GUICtrlCreateButton("看看选几个", 142, 248, 113, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Write()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
RdListView()
EndSwitch
WEnd
Func Write()
For $i = 1 To 10
GUICtrlCreateListViewItem($i & '|KB' & $i, $ListView1)
Next
EndFunc ;==>Write
Func RdListView()
$s = 0
$log = _GUICtrlListView_GetItemCount($ListView1)
For $i = 0 To $log
If _GUICtrlListView_GetItemChecked($ListView1, $i) = True Then
$s += 1
MsgBox(0, '', '你选择了第' & $i + 1 & '个项目')
EndIf
Next
MsgBox(0, '', '你选择了' & $s & '个项目,' & $log - $s & '个项目没有选择')
EndFunc ;==>RdListView
|