BOOL DlgDirSelect(hDlg,lpString,nIDListBox)
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 DlgDirSelect function copies the selection to the buffer given by the lpString parameter. If the current selection is a directory name or drive letter, DlgDirSelect 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.
DlgDirSelect sends LB_GETCURSEL and LB_GETTEXT messages to the list box.
Parameter | Type/Description | |
hDlg | HWND Identifies the dialog box that contains the list box. | |
lpString | LPSTR Points to a buffer that is to receive the selected pathname. | |
nIDListBox | int Specifies the integer ID of a list-box control in the dialog box. |
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.
The DlgDirSelect 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.