Funktionsreferenz


_GUICtrlListBox_GetCount

Ermittelt die Anzahl an Items

#include <GuiListBox.au3>
_GUICtrlListBox_GetCount($hWnd)

Parameter

$hWnd Control-ID / Handle des Controls

Rückgabewert

Erfolg: Die Anzahl an Items in der Listbox
Fehler: -1

Bemerkungen

- - - - - - - - Erklärung der Controls - - - - - - - -

Verwandte Funktionen

Beispiel


#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

$Debug_LB = False ; Prüft den Klassennamen (ClassName), der an die ListBox-Funktion übergeben wird. Setze dies versuchsweise auf True und verwende dann ein Handle zu einem anderen Control, um die Funktionsweise zu verstehen.

_Main()

Func _Main()
    Local $hListBox

    ; Erstellt eine GUI
    GUICreate("ListBox: Ermittelt die Anzahl an Items", 400, 296)
    $hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

    GUISetState()

    ; Fügt Strings hinzu
    _GUICtrlListBox_BeginUpdate($hListBox)
    For $iI = 1 To 9
        _GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Zufallstring", Random(1, 100, 1)))
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

    ; Ermittelt die Anzahl an Items
    MsgBox(4160, "Information", "Anzahl an Items: " & _GUICtrlListBox_GetCount($hListBox))

    ; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main