Microsoft KB Archive/130761

-

{| The information in this article applies to:
 * width="100%"|
 * Microsoft Win32 Application Programming Interface (API) included with: - Microsoft Windows 95

SUMMARY
This article covers the format of file names returned by the FileOpen common dialog with the OFN_ALLOWMULTISELECT style.

The FileOpen common dialog can be used to specify the location (drive and directory) and name of a file or a set of files. One of the flags needed to provide mulitple-file selection from the FileOpen common dialog is the OFN_ALLOWMULTISELECT flag. When this flag is used, and the user makes a valid selection, the file or files chosen by the user are returned in the lpstrFile member of the OPENFILENAME structure. The format of the string returned in the lpstrFile member depends on how many files (single or multiple) the user selected. This article assumes that the OFN_EXPLORER Style is set for the file open dialog.

MORE INFORMATION
If multiple files were selected, the string is of this form:

Drive: \Directory Name\0FileName 1\0FileName 2\0FileName n\0\0. The Directory Name is listed first. Then each file that was selected is listed with a terminating NULL Character, except for the last filename, which is terminated with two NULL characters. The two NULL characters signal the end of the string. If a single file was selected, the string is of this form:

Drive: \Directory Name\FileName\0\0. The Directory Name in this case is not terminated by a NULL character, and the file name is terminated with two NULL characters. Applications must parse the string returned in the lsptrFile member. In doing so, they should make provisions in the parsing code to have a case where the user can make a single selection (even though the OFN_ALLOWMULTISELECT flag is set) or multiple selections.

NOTE: When using OFN_ALLOWMULTISELECT under Windows 95, you need to use the OFN_EXPLORER flag to get the explorer style dialog and NULL terminated strings. If you don't use OFN_EXPLORER with OFN_ALLOWMULTISELECT, you get the old style dialog and space-delimited strings.

Keywords         : UsrCmnDlg kbui Platform         : WINDOWS
 * }

-

Last reviewed: January 15, 1998

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.