Function Reference


_GUICtrlListView_GetItemCount

Retrieves the number of items in a list-view control

#include <GuiListView.au3>
_GUICtrlListView_GetItemCount ( $hWnd )

Parameters

$hWnd Control ID/Handle to the control

Return Value

Returns the number of items.

Related

_GUICtrlListView_SetItemCount

Example

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $idListview

    GUICreate("ListView Get/Set Item Count (v" & @AutoItVersion & ")", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 100)

    ; Add items
    _GUICtrlListView_SetItemCount($idListview, 100)
    _GUICtrlListView_BeginUpdate($idListview)
    For $x = 0 To 4
        GUICtrlCreateListViewItem("Item " & $x, $idListview)
    Next
    _GUICtrlListView_EndUpdate($idListview)

    MsgBox($MB_SYSTEMMODAL, "Information", "Item Count: " & _GUICtrlListView_GetItemCount($idListview))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example