BUG:File Open Common Dialog in Win95 Returns Invalid FilenameLast reviewed: October 3, 1996Article ID: Q139972 |
The information in this article applies to:
SYMPTOMSCalling the ShowOpen method of the common dialog control to show the File Open common dialog box results in the following error:
Run-time error '20477' Invalid filename CAUSEThis error occurs the second time the ShowOpen method is called after multiple file names have been previously selected in the File Open dialog box. The only time this error occurs is when the Flags property of the common dialog box includes both cdlOFNAllowMultiselect (to allow multiple selections) and cdlOFNExplorer (to use the Windows Explorer File Open dialog box). Without the new shell, Microsoft Windows NT does not display the Windows Explorer Open File dialog box, so this problem only occurs with Microsoft Windows 95. In this case, clicking multiple files in the File Open dialog box and clicking Open causes the FileName property of the common dialog control to be filled with a NULL delimited string of filenames. When the ShowOpen method is called, an attempt is made to set the default file(s) to whatever the FileName property of the common dialog control is. The error results because the common dialog control does not know what to do when it encounters embedded NULLs in the FileName property.
WORKAROUNDNULLs must be used instead of spaces to delimit the list of file names because the Windows Explorer style Open File common dialog box with multiple selections enabled automatically includes support for long filenames. However, because the Open File dialog box does not accept a list of NULL delimited files when it is displayed, there is no way to have multiple files selected by default when displaying the Open File dialog box. Use either of the following methods to avoid the error described above: In your code, before the ShowOpen method is called again, reset the FileName property of the common dialog box to a single file or to no file at all. - or - Do not use the cdlOFNAllowMultiselect and cdlOFNExplorer flags at the same time. Search on "CommonDialog control," Topic: "Changes to CommonDialog Flags for Windows 95 and Windows NT," in the Visual Basic Help file for more information on the behavior of different combinations of these constants under different operating systems.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of the article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Steps to reproduce problem (under Windows 95 only)
REFERENCESVisual Basic for Windows Help file version 4.0; Search on "CommonDialog control,"; Topic: "Changes to CommonDialog Flags for Windows 95 and Windows NT,".
|
Additional reference words: 4.00 vb4win vb4all buglist4.00 win95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |