CComboBox::Dir

int Dir( UINT attr, LPCTSTR lpszWildCard );

Return Value

If the return value is greater than or equal to 0, it is the zero-based index of the last filename added to the list. The return value is CB_ERR if an error occurs; the return value is CB_ERRSPACE if insufficient space is available to store the new strings.

Parameters

attr

Can be any combination of the enum values described in CFile::GetStatus or any combination of the following values:

lpszWildCard

Points to a file-specification string. The string can contain wildcards (for example, *.*).

Remarks

Adds a list of filenames and/or drives to the list box of a combo box.

Example

// The pointer to my combo box.
extern CComboBox* pmyComboBox;

// Add all the files and directories in the windows directory.
TCHAR lpszWinPath[MAX_PATH], lpszOldPath[MAX_PATH];
::GetWindowsDirectory(lpszWinPath, MAX_PATH);

// Make the windows directory the current directory.
::GetCurrentDirectory(MAX_PATH, lpszOldPath);
::SetCurrentDirectory(lpszWinPath);

pmyComboBox->ResetContent();
pmyComboBox->Dir(DDL_READWRITE|DDL_DIRECTORY, _T("*.*"));

// Reset the current directory to its previous path.
::SetCurrentDirectory(lpszOldPath);

CComboBox OverviewClass MembersHierarchy Chart

See Also   CWnd::DlgDirList, CB_DIR, CFile::GetStatus