int DlgDirList(hwndDlg, lpPathSpec, nIDListBox, nIDStaticPath, wFiletype) | |||||
HWND hwndDlg; | /* handle of dialog box with list box | */ | |||
LPTSTR lpPathSpec; | /* address of path or filename string | */ | |||
int nIDListBox; | /* identifier of list box | */ | |||
int nIDStaticPath; | /* identifier of static control | */ | |||
UINT wFiletype; | /* file attributes to display | */ |
This function fills a list-box control with a file or directory listing. It fills the list box specified by the nIDListBox parameter with the names of all files matching the pathname given by the lpPathSpec parameter.
The DlgDirList function shows subdirectories enclosed in square brackets ([ ]), and shows drives in the form [-x-], where x is the drive letter.
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 character. The wildcard characters are a question mark (?), meaning match any character, and an asterisk (*), meaning match any number of characters.
If the lpPathSpec parameter includes a drive and/or directory name, the current drive and directory are changed to the designated drive and directory before the list box is filled. The text control identified by the nIDStaticPath parameter is also updated with the new drive and/or directory name.
After the list box is filled, lpPathSpec is updated by removing the drive and/or directory portion of the pathname.
DlgDirList sends LB_RESETCONTENT and LB_DIR messages to the list box.
hwndDlg
Identifies the dialog box that contains the list box.
lpPathSpec
Points to a pathname string. The string must be a null-terminated character string.
nIDListBox
Specifies the identifier of a list-box control. If nIDListBox is zero, DlgDirList assumes that no list box exists and does not attempt to fill it.
nIDStaticPath
Specifies the identifier of the static-text control used for displaying the current drive and directory. If nIDStaticPath is zero, DlgDirList assumes that no such text control is present.
wFiletype
Specifies DOS file attributes of the files to be displayed. It can be any combination of the following values:
Value | Meaning |
0x0000 | Read/write data files with no additional attributes |
0x0001 | Read-only files |
0x0002 | Hidden files |
0x0004 | System files |
0x0010 | Subdirectories |
0x0020 | Archives |
0x2000 | LB_DIR flag. If the LB_DIR flag is set, Windows places the messages generated by DlgDirList in the application's queue; otherwise they are sent directly to the dialog function. |
0x4000 | Drives |
0x8000 | Exclusive bit. If the exclusive bit is set, only files of the specified type are listed. Otherwise, files of the specified type are listed in addition to normal files. |
The return value specifies the outcome of the function. It is nonzero if a listing was made, even an empty listing. A zero return value implies that the input string did not contain a valid search path.
The DlgDirList function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
DlgDirSelectEx, DlgDirListComboBox, DlgDirSelectComboBoxEx