DlgDirSelectComboBoxEx function

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 DlgDirSelectComboBoxEx(
  _In_   HWND hDlg,
  _Out_  LPTSTR lpString,
  _In_   int nCount,
  _In_   int nIDComboBox
);

Parameters

hDlg [in]

Type: HWND

A handle to the dialog box that contains the combo box.

lpString [out]

Type: LPTSTR

A pointer to the buffer that receives the selected path.

nCount [in]

Type: int

The length, in characters, of the buffer pointed to by the lpString parameter.

nIDComboBox [in]

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.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

DlgDirSelectComboBoxExW (Unicode) and DlgDirSelectComboBoxExA (ANSI)

See also

Reference
CB_GETCURSEL
CB_GETLBTEXT
DlgDirListComboBox

 

 

Community Additions

ADD
Show:
© 2015 Microsoft