CWnd::DlgDirList
Fills a list box with a file or directory listing.
int DlgDirList( LPTSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT nFileType );
DlgDirList sends LB_RESETCONTENT and LB_DIR messages to the list box. It fills the list box specified by nIDListBox with the names of all files that match the path given by lpPathSpec.
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. The wildcards are a question mark (?), which means match any character, and an asterisk (*), meaning match any number of characters.
If you specify a 0-length string for lpPathSpec, or if you specify only a directory name but do not include any file specification, the string will be changed to "*.*".
If lpPathSpec 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 nIDStaticPath 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 path.
// If pDialog points to a CDialog object with a list box // with the identifier IDC_DIRLIST, this call will populate // the box with only the non-hidden subdirectories in the root // directory of the C:\ drive. TCHAR path[MAX_PATH]; _tcscpy_s(path, MAX_PATH, _T("C:\\")); pDialog->DlgDirList(path, IDC_DIRLIST, 0, DDL_EXCLUSIVE | DDL_DIRECTORY);