CB_DIR message

Adds names to the list displayed by the combo box. The message adds the names of directories and files that match a specified string and set of file attributes. CB_DIR can also add mapped drive letters to the list.



The attributes of the files or directories to be added to the combo box. This parameter can be one or more of the following values.

Value Meaning
Includes archived files.
Includes subdirectories, which are enclosed in square brackets ([ ]).
All mapped drives are added to the list. Drives are listed in the form [-x-], where x is the drive letter.
Includes only files with the specified attributes. By default, read/write files are listed even if DDL_READWRITE is not specified.
Includes hidden files.
Includes read-only files.
Includes read/write files with no additional attributes. This is the default.
Includes system files.


An LPCTSTR pointer to a null-terminated string that specifies an absolute path, relative path, or file name. An absolute path can begin with a drive letter (for example, d:) or a UNC name (for example, \\machinename\sharename). If the string specifies a file name or directory that has the attributes specified by the wParam parameter, the file name or directory is added to the list. If the file name or directory name contains wildcard characters (? or *), all files or directories that match the wildcard expression and have the attributes specified by the wParam parameter are added to the list displayed in the combo box.

Return value

If the message succeeds, the return value is the zero-based index of the last name added to the list.

If an error occurs, the return value is CB_ERR. If there is insufficient space to store the new strings, the return value is CB_ERRSPACE.


If wParam includes the DDL_DIRECTORY flag and lParam specifies all the subdirectories of a first-level directory, such as C:\TEMP\*, the list box will always include a ".." entry for the root directory. This is true even if the root directory has hidden or system attributes and the DDL_HIDDEN and DDL_SYSTEM flags are not specified. The root directory of an NTFS volume has hidden and system attributes.

The list displays long file names, if any.


Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Winuser.h (include Windows.h)

See also