Function Reference


_GUICtrlComboBoxEx_InitStorage

Allocates memory for storing ListBox items

#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_InitStorage ( $hWnd, $iNum, $iBytes )

Parameters

$hWnd Handle to the control
$iNum Number of items to add
$iBytes The amount of memory to allocate for item strings, in bytes

Return Value

Success: the total number of items for which memory has been pre-allocated.
Failure: $CB_ERRSPACE.

Remarks

Helps speed up the initialization of ComboBoxes that have a large number of items (over 100).

You can use estimates for the $iNum and $iBytes parameters.
If you overestimate, the extra memory is allocated.
If you underestimate, the normal allocation is used for items that exceed the requested amount.

Related

_GUICtrlComboBoxEx_AddDir, _GUICtrlComboBoxEx_AddString, _GUICtrlComboBoxEx_InsertString

Example

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

Example()

Func Example()
        Local $hGUI, $hCombo

        ; Create GUI
        $hGUI = GUICreate("ComboBoxEx Init Storage", 400, 300)
        $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 396, 296, $CBS_SIMPLE)
        GUISetState(@SW_SHOW)

        MsgBox($MB_SYSTEMMODAL, "Information", "Init Storage Pre-Allocated Memory For: " & _GUICtrlComboBoxEx_InitStorage($hCombo, 150, 300) & " Items")
        _GUICtrlComboBoxEx_BeginUpdate($hCombo)

        For $x = 0 To 149
                _GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
        Next
        _GUICtrlComboBoxEx_EndUpdate($hCombo)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example