How to enhance the method of using the Open File common dialog class with multiple extension filters (200421)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q200421 SUMMARY When you use the Open File common dialog class,
CFileDialog, you can specify filters containing multiple extensions. In such a
case, when the user enters the file name without an extension, the Open File
common dialog class looks for a file with the specified file name, or a file
name obtained by concatenating the file name and the .one default extension
(specified in the lpstrDefExt field of the OPENFILENAME structure).
This article shows you how to enhance this behavior. After the user specifies a
file name and clicks OK, the enhanced dialog class looks for a file that
matches the specified file name. If none is found, the new dialog class tries
to build file names by successively concatenating the user specified file name
with the extensions from the current filter. If a file exists that matches the
new file name, this file name is accepted. REFERENCES
For more information about how to customize common file dialogs, click the following article number to view the article in the Microsoft Knowledge Base:
195034
OfnKing demonstrates CFileDialog customization
Modification Type: | Major | Last Reviewed: | 8/31/2005 |
---|
Keywords: | kbCmnDlgFileO kbDlg kbhowto KbUIDesign KB200421 kbAudDeveloper |
---|
|