The aFlag argument is used to pass one or more options that determine the appearance of the dialog box. For each option, the value of the flag is 2^(index -1), where index is an integer associated with each option as shown in the following table. You can pass multiple options by passing an aggregate flag, calculated by adding the values of the individual flags.
If you do not pass an aFlag, the Explorer-style open file dialog box is used. If you do pass a flag, the old-style dialog box is used by default. Some options do not apply when the Explorer-style dialog box is used. For those that do apply, add the option value for using the Explorer-style dialog box (2) to the value of the option if you want to display an Explorer-style dialog box.
For example, passing the flag 32768 (2^15) to the GetFileSaveName function opens the old-style dialog box with the Read Only check box selected by default. Passing the flag 32770 opens the Explorer-style dialog box with the Read Only check box selected by default
Index Constant name Description
1 OFN_CREATEPROMPT If the specified file does not exist, prompt for permission to create the file. If the user chooses to create the file, the dialog box closes; otherwise the dialog box remains open.
2 OFN_EXPLORER Use an Explorer-style dialog box.
3 OFN_EXTENSIONDIFFERENT The file extension entered differed from the extensions specified in extension.
4 OFN_FILEMUSTEXIST Only the names of existing files can be entered.
5 OFN_HIDEREADONLY Hide the Read Only check box.
6 OFN_LONGNAMES Use long file names. Ignored for Explorer-style dialog boxes.
7 OFN_NOCHANGEDIR Restore the current directory to its original value if the user changed the directory while searching for files. This option has no effect for GetFileOpenName on Windows NT, 2000, and XP.
8 OFN_NODEREFERENCELINKS Return the path and file name of the selected shortcut (.lnk file); otherwise the path and file name pointed to by the shortcut are returned.
9 OFN_NOLONGNAMES Use short file names (8.3 format). Ignored for Explorer-style dialog boxes.
10 OFN_NONETWORKBUTTON Hide the Network button. Ignored for Explorer-style dialog boxes.
11 OFN_NOREADONLYRETURN The file returned is not read only and is not in a write-protected directory.
12 OFN_NOTESTFILECREATE Do not create the file before the dialog box is closed. This option should be specified if the application saves the file on a netwrok share where files can be created but not modified. No check is made for write protection, a full disk, an open drive door, or network protection. A file cannot be reopened once it is closed.
13 OFN_NOVALIDATE Invalid characters are allowed in file names.
14 OFN_OVERWRITEPROMPT Used in Save As dialog boxes. Generates a message box if the selected file already exists.
15 OFN_PATHMUSTEXIST Only valid paths and file names can be entered.
16 OFN_READONLY Select the Read Only check box when the Save dialog box is created.
|