Function Reference


_GUICtrlComboBox_InitStorage

Allocates memory for storing ListBox items

#include <GuiComboBox.au3>
_GUICtrlComboBox_InitStorage ( $hWnd, $iNum, $iBytes )

Parameters

$hWnd Control ID/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

_GUICtrlComboBox_AddDir, _GUICtrlComboBox_AddString, _GUICtrlComboBox_InsertString

Example

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

Example()

Func Example()
    Local $idCombo

    ; Create GUI
    GUICreate("ComboBox Init Storage", 400, 296)
    $idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    GUISetState(@SW_SHOW)

    ; Init Storaged
    MsgBox($MB_SYSTEMMODAL, "Information", "Pre-Allocated Memory For: " & _GUICtrlComboBox_InitStorage($idCombo, 50, 500) & " items")

    ; Add files
    _GUICtrlComboBox_BeginUpdate($idCombo)
    _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate($idCombo)

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