Function Reference


_GUICtrlListBox_InitStorage

This message allocates memory for storing items

#include <GuiListBox.au3>
_GUICtrlListBox_InitStorage ( $hWnd, $iItems, $iBytes )

Parameters

$hWnd Control ID/Handle to the control
$iItems The total amount of items that you intend to add
$iBytes The total amount of memory your strings will consume

Return Value

Returns the total number of items for which memory has been pre-allocated.

Related

_GUICtrlListBox_AddFile, _GUICtrlListBox_AddString, _GUICtrlListBox_Dir, _GUICtrlListBox_InsertString

Example

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

Example()

Func Example()
        Local $idListBox

        ; Create GUI
        GUICreate("List Box Init Storage", 400, 296)
        $idListBox = GUICtrlCreateList("", 2, 2, 396, 296)
        GUISetState(@SW_SHOW)

        ; Add files
        _GUICtrlListBox_BeginUpdate($idListBox)
        _GUICtrlListBox_ResetContent($idListBox)
        MsgBox($MB_SYSTEMMODAL, "Information", "Storage Allocated: " & _GUICtrlListBox_InitStorage($idListBox, 100, 4096))
        _GUICtrlListBox_Dir($idListBox, @WindowsDir & "\win*.exe")
        _GUICtrlListBox_AddFile($idListBox, @WindowsDir & "\notepad.exe")
        _GUICtrlListBox_EndUpdate($idListBox)

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