Microsoft KB Archive/200072

= How To Initializing lpstrFilter for All Files on the Macintosh =

Article ID: 200072

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual C++ 4.0 Cross Development Edition for Macintosh
 * Microsoft Visual C++ 4.0 Cross Development Edition for Macintosh

-



This article was previously published under Q200072



SUMMARY
On the Macintosh, to list all files, you must use "****" as the filter string (lpstrFilter) for the open file dialog box (GetOpenFileName).



MORE INFORMATION
GetOpenFileName uses the lpstrFilter field of the OPENFILENAME structure to specify file filters. It points to a list of string pairs, separated by null characters. Each pair contains the display string and the filter pattern. On the Intel platform, a filter string of "*.*" specifies all files. The Windows Portability Library (WPL) uses "****", instead. Below is an MFC-based example: CString strFilter; CFileDialog dlgFile(TRUE); CString allFilter = "All Files (*.*)"; strFilter += allFilter; strFilter += (TCHAR)'\0';  // Next string please.


 * 1) ifndef _MAC

strFilter += _T("*.*");


 * 1) else

strFilter += _T("****");


 * 1) endif

strFilter += (TCHAR)'\0';  // Last string. dlgFile.m_ofn.lpstrFilter = strFilter;

