DlgDirSelectEx

  BOOL DlgDirSelectEx(hwndDlg, lpString, cchString, nIDListBox)    
  HWND hwndDlg; /* handle of dialog box with list box */
  LPTSTR lpString; /* address of buffer for path string */
  int cchString; /* number of characters in path string */
  int nIDListBox; /* identifier of list box */

This function retrieves the current selection from a list box. It assumes that the list box has been filled by the DlgDirList function and that the selection is a drive letter, a file, or a directory name.

The DlgDirSelectEx function copies the selection to the buffer given by the lpString parameter. If the current selection is a directory name or drive letter, DlgDirSelectEx removes the enclosing square brackets (and hyphens, for drive letters) so that the name or letter is ready to be inserted into a new pathname. If there is no selection, lpString does not change.

DlgDirSelectEx sends LB_GETCURSEL and LB_GETTEXT messages to the list box.

Parameters

hwndDlg

Identifies the dialog box that contains the list box.

lpString

Points to a buffer that is to receive the selected pathname.

cchString

Specifies the length of the buffer (in characters) pointed to by lpString.

nIDListBox

Specifies the integer ID of a list-box control in the dialog box.

Return Value

The return value specifies the status of the current list-box selection. It is nonzero if the current selection is a directory name. Otherwise, it is zero.

Comments

The DlgDirSelectEx function does not allow more than one filename to be returned from a list box.

The list box must not be a multiple-selection list box. If it is, this function will not return a zero value and lpString will remain unchanged.

The DlgDirSelectEx 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).

See Also

DlgDirList, DlgDirSelectComboBoxEx, DlgDirListComboBox