Adds the names of directories and files
#include <GuiListBox.au3>
_GUICtrlListBox_Dir ( $hWnd, $sFilePath [, $iAttributes = 0 [, $bBrackets = True]] )
$hWnd | Control ID/Handle to the control |
$sFilePath | Specifies an absolute path, relative path, or filename |
$iAttributes | [optional] Specifies the attributes of the files or directories to be added: $DDL_READWRITE - Includes read-write files with no additional attributes $DDL_READONLY - Includes read-only files $DDL_HIDDEN - Includes hidden files $DDL_SYSTEM - Includes system files $DDL_DIRECTORY - Includes subdirectories $DDL_ARCHIVE - Includes archived files $DDL_DRIVES - All mapped drives are added to the list $DDL_EXCLUSIVE - Includes only files with the specified attributes |
$bBrackets | [optional] include/exclude brackets when $DDL_DRIVES is used |
Success: | a 0-based index of the last name added. |
Failure: | -1. |
If there is insufficient space to store the new strings, the return value is $LB_ERRSPACE.
#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
Local $idListBox
; Create GUI
GUICreate("List Box Dir", 400, 296)
$idListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState(@SW_SHOW)
; Add files
_GUICtrlListBox_BeginUpdate($idListBox)
_GUICtrlListBox_ResetContent($idListBox)
_GUICtrlListBox_InitStorage($idListBox, 100, 4096)
_GUICtrlListBox_Dir($idListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($idListBox, @WindowsDir & "\notepad.exe")
_GUICtrlListBox_Dir($idListBox, "", $DDL_DRIVES)
_GUICtrlListBox_Dir($idListBox, "", $DDL_DRIVES, False)
_GUICtrlListBox_EndUpdate($idListBox)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example