DlgDirListComboBox

Version 3.0

Syntax

int DlgDirListComboBox(hDlg,lpPathSpec,nIDComboBox,nIDStaticPath,wFiletype)

This function fills the list box of a combo-box control with a file or directory listing. It fills the list box of the combo box specified by the nIDComboBox parameter with the names of all files matching the pathname given by the lpPathSpec parameter.

The DlgDirListComboBox 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:]] [[ [[\]]directory[[\directory]]...\]] [[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 combo-box list box is filled, lpPathSpec is updated by removing the drive and/or directory portion of the pathname.

DlgDirListComboBox sends CB_RESETCONTENT and CB_DIR messages to the combo box.

Parameter Type/Description  
hDlg HWND Identifies the dialog box that contains the combo box.  
lpPathSpec LPSTR Points to a pathname string. The string must be a null-terminated character string.  
nIDComboBox int Specifies the identifier of a combo-box control in a dialog box. If nIDComboBox is zero, DlgDirListComboBox assumes that no combo box exists and does not attempt to fill it.  
nIDStaticPath int Specifies the identifier of the static-text control used for displaying the current drive and directory. If nIDStaticPath is zero, DlgDirListComboBox assumes that no such text control is present.  
wFiletype WORD Specifies DOS file attributes of the files to be displayed. It can be any combination of the values given in Table R.6, “DOS File Attributes.” Refer to the description of the DlgDirList function for this table. Values can be combined by using the bitwise OR operator.  

Return Value

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.