int DlgDirList(hwndDlg, lpszPath, idListBox, idStaticPath, uFileType) | |||||
HWND hwndDlg; | /* handle of dialog box with list box | */ | |||
LPSTR lpszPath; | /* address of path or filename string | */ | |||
int idListBox; | /* identifier of list box | */ | |||
int idStaticPath; | /* identifier of static control | */ | |||
UINT uFileType; | /* file attributes to display | */ |
The DlgDirList function fills a list box with a file or directory listing. It fills the list box with the names of all files matching the specified path or filename.
hwndDlg
Identifies the dialog box that contains the list box.
lpszPath
Points to a null-terminated string that contains the path or filename. DlgDirList modifies this string, which should be long enough to contain the modifications. For more information, see the following Comments section.
idListBox
Specifies the identifier of a list box. If this parameter is zero, DlgDirList assumes that no list box exists and does not attempt to fill one.
idStaticPath
Specifies the identifier of the static control used for displaying the current drive and directory. If this parameter is zero, DlgDirList assumes that no such control is present.
uFileType
Specifies the attributes of the filenames to be displayed. This parameter can be a combination of the following values:
Value | Meaning |
DDL_READWRITE | Read-write data files with no additional attributes. |
DDL_READONLY | Read-only files. |
DDL_HIDDEN | Hidden files. |
DDL_SYSTEM | System files. |
DDL_DIRECTORY | Directories. |
DDL_ARCHIVE | Archives. |
DDL_POSTMSGS | 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 box procedure. |
DDL_DRIVES | Drives. |
DDL_EXCLUSIVE | 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 is nonzero if the function is successful. Otherwise, it is zero.
If you specify a zero-length string for the lpszPath parameter or if you specify only a directory name but do not include any filename, the string will be changed to *.*.
The DlgDirList function shows directories enclosed in brackets ([ ]) and shows drives in the form [-x-], where x is the drive letter.
The lpszPath parameter has the following form:
[drive:][[\]directory[\directory] . . . \][filename]
In this example, drive is a drive letter, directory is a valid MS-DOS directory name, and filename is a valid MS-DOS filename that must contain at least one wildcard. The wildcards are a question mark (?), meaning match any character, and an asterisk (*), meaning match any number of characters.
If the lpszPath parameter 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 idStaticPath parameter is also updated with the new drive or directory name, or both.
After the list box is filled, lpszPath is updated by removing the drive or directory portion, or both, of the path and filename.
DlgDirList sends LB_RESETCONTENT and LB_DIR messages to the list box.