DlgDirSelectComboBoxExW function (winuser.h)
Retrieves the current selection from a combo box filled by using the DlgDirListComboBox function. The selection is interpreted as a drive letter, a file, or a directory name.
Syntax
BOOL DlgDirSelectComboBoxExW(
[in] HWND hwndDlg,
[out] LPWSTR lpString,
[in] int cchOut,
[in] int idComboBox
);
Parameters
[in] hwndDlg
Type: HWND
A handle to the dialog box that contains the combo box.
[out] lpString
Type: LPTSTR
A pointer to the buffer that receives the selected path.
[in] cchOut
Type: int
The length, in characters, of the buffer pointed to by the lpString parameter.
[in] idComboBox
Type: int
The integer identifier of the combo box control in the dialog box.
Return value
Type: BOOL
If the current selection is a directory name, the return value is nonzero.
If the current selection is not a directory name, the return value is zero. To get extended error information, call GetLastError.
Remarks
If the current selection specifies a directory name or drive letter, the DlgDirSelectComboBoxEx function removes the enclosing square brackets (and hyphens for drive letters) so the name or letter is ready to be inserted into a new path or file name. If there is no selection, the contents of the buffer pointed to by lpString do not change.
The DlgDirSelectComboBoxEx function does not allow more than one file name to be returned from a combo box.
If the string is as long or longer than the buffer, the buffer contains the truncated string with a terminating null character.
DlgDirSelectComboBoxEx sends CB_GETCURSEL and CB_GETLBTEXT messages to the combo box.
You can use this function with all three types of combo boxes (CBS_SIMPLE, CBS_DROPDOWN, and CBS_DROPDOWNLIST).
Security Warning: Improper use of this function can cause problems for your application. For instance, the nCount parameter should be set properly for both ANSI and Unicode versions. Failure to do so could lead to a buffer overflow. You should review Security Considerations: Microsoft Windows Controls before continuing.
Windows 95 or later: DlgDirSelectComboBoxExW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems.
Note
The winuser.h header defines DlgDirSelectComboBoxEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
See also
Reference