PRB: GetOpenFileName() and Spaces in Long Filenames

Last reviewed: October 10, 1996
Article ID: Q108233
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.1 and 3.5
    

SYMPTOMS

GetOpenFileName() is the application programming interface (API) for the open file common dialog box. This API displays the long filenames (LFNs) on NTFS and HPFS.

When using the OFN_ALLOWMULTISELECT flag with the GetOpenFileName() API, the dialog box automatically presents the 8.3 names for all LFNs that contain embedded spaces.

CAUSE

The original design of GetOpenFileName() uses a filename list that is space-delimited when the OFN_ALLOWMULTISELECT flag is specified. Thus, there is no programmatic way to determine which string tokens are complete filenames or fragments of a complete name with spaces.

STATUS

This behavior is by design. Microsoft is considering changing this behavior in a future release of Windows NT.

MORE INFORMATION

Historically, FAT filenames that contained embedded spaces were branded as "illegal," even though the specifications of the FAT file system do not impose such a restriction. For example, many of the MS-DOS command-line utilities do no allow the user to specify filenames with embedded spaces, because of difficulties that would be introduced in parsing the command line. Under Windows NT, the command utilities have been enhanced to support such names if they are in quotation marks.


Additional reference words: 3.10 3.50 File Open OFN_ALLOWMULTISELECT long
filename lfn
KBCategory: kbui kbprb
KBSubcategory: UsrCmnDlg


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 10, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.