選択されたアイテムの数を取得します。
#Include <GuiListView.au3>
_GUICtrlListView_GetSelectedCount($hWnd)
パラメータ
$hWnd | コントロールのハンドル |
返し値
選択されたアイテムの数を返します。
注意
なし。
関連
例
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
Opt('MustDeclareVars', 1)
$Debug_LV = False ; ListView関数に渡されるClassNameを調べる。動作を確認するにはTrueを設定し、他のコントロールのハンドルを使用
_Main()
Func _Main()
Local $hListView
GUICreate("ListView Get Selected Count", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()
; 列を追加
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
; アイテムを追加
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")
; 複数のアイテムを選択
_GUICtrlListView_SetItemSelected($hListView, 1)
_GUICtrlListView_SetItemSelected($hListView, 2)
MsgBox(4160, "Information", "Selected Count: " & _GUICtrlListView_GetSelectedCount($hListView))
; ユーザーが終了するまでループ
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main