# Function Reference

# _GUICtrlListBox_AddFile

Adds the specified filename that contains a directory listing

#include <GuiListBox.au3>
_GUICtrlListBox_AddFile ( $hWnd, $sFilePath )

## Parameters

$hWnd | Control ID/Handle to the control
$sFilePath | Name of the file to add

## Return Value

Success: | a 0-based index of the file that was added.
Failure: | -1.

## Related

_GUICtrlListBox_AddString, _GUICtrlListBox_DeleteString, _GUICtrlListBox_InitStorage

## Example

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

    Example()

    Func Example()
        Local $idListBox

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

        ; Add file
        _GUICtrlListBox_AddFile($idListBox, @WindowsDir & "\notepad.exe")

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