The DlgDirList function fills the specified list box with the names of all files matching the specified path or filename.
int DlgDirList(
HWND hDlg, // handle to dialog box with list box
LPTSTR lpPathSpec, // pointer to path or filename string
int nIDListBox, // identifier of list box
int nIDStaticPath, // identifier of static control
UINT uFileType // file attributes to display
);
Value | Description |
---|---|
DDL_ARCHIVE | Includes archived files. |
DDL_DIRECTORY | Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]). |
DDL_DRIVES | Includes drives. Drives are listed in the form [-x-], where x is the drive letter. |
DDL_EXCLUSIVE | Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified. |
DDL_HIDDEN | Includes hidden files. |
DDL_READONLY | Includes read-only files. |
DDL_READWRITE | Includes read-write files with no additional attributes. |
DDL_SYSTEM | Includes system files. |
DDL_POSTMSGS | Posts messages to the application's message queue. By default, DlgDirList sends messages directly to the dialog box procedure. |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. For example, if the string specified by lpPathSpec is not a valid path, the function fails. To get extended error information, call GetLastError.
If you specify a zero-length string for the lpPathSpec parameter or if you specify only a directory name with no filename, the string will be changed to *.*
The lpPathSpec parameter has the following form:
[drive:] [[\u]directory[\idirectory]\u] [filename]
In this example, drive is a drive letter, directory is a valid directory name, and filename is a valid filename that must contain at least one wildcard (? or *).
If lpPathSpec includes a drive or directory name, or both, the current drive and directory are changed to the specified drive and directory before the list box is filled. The static control identified by the nIDStaticPath parameter is also updated with the new drive or directory name, or both.
After the list box is filled, DlgDirList updates lpPathSpec by removing the drive or directory portion, or both, of the path and filename.
DlgDirList sends the LB_RESETCONTENT and LB_DIR messages to the list box.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
List Boxes Overview, List Box Functions, DlgDirListComboBox, DlgDirSelectComboBoxEx, DlgDirSelectEx