Function Reference

_GUICtrlComboInitStorage

Allocates memory for storing list box portion of the combo box items

#Include <GuiCombo.au3>
_GUICtrlComboInitStorage($h_combobox, $i_num, $i_bytes)

 

Parameters

$h_combobox control id/control hWnd
$i_num Specifies the number of items to add
$i_bytes Specifies the amount of memory to allocate for item strings, in bytes

 

Return Value

Success: Returns is the total number
Failure: Returns $CB_ERRSPACE if the message fails.

 

Remarks

Windows NT 4.0: This message does not allocate the specified amount of memory
however, it always returns the value specified in the $i_num parameter.

Windows 2000/XP: The message allocates memory and returns the success and error values described above

The $CB_INITSTORAGE message helps speed up the initialization of combo boxes
that have a large number of items (over 100).

It reserves the specified amount of memory so that subsequent $CB_ADDSTRING,
$CB_INSERTSTRING, and $CB_DIR messages take the shortest possible time.

You can use estimates for the $i_num and $i_bytes 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

_GUICtrlComboAddDir

 

Example


#include <GuiConstants.au3>
#include <GuiCombo.au3>

Opt('MustDeclareVars',1)

Dim $Combo,$ret,$Btn_Exit,$Status,$msg,$allocated

GuiCreate("ComboBox Init Storage", 392, 254)

$Combo = GuiCtrlCreateCombo("", 70, 10, 270, 100,$CBS_SIMPLE)
$allocated = _GUICtrlComboInitStorage($Combo, 26, 50)
$ret = _GUICtrlComboAddDir($Combo,"drives")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
$Status = GUICtrlCreateLabel("",0,234,392,20,BitOR($SS_SUNKEN,$SS_CENTER))
GUICtrlSetData($Status,"Pre-Allocated Memory For: " & $allocated & " Items, Drives Added To ComboBox: " & _GUICtrlComboGetCount($Combo))
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
    EndSelect
WEnd
Exit