IFileDialog2::GetOptions Method

Gets the current flags that are set to control dialog behavior.

Syntax

HRESULT GetOptions(      
    FILEOPENDIALOGOPTIONS *fos
);

Parameters

  • fos
    [out] A pointer to a value made up of one or more of the following flags:
    • FOS_OVERWRITEPROMPT
      When saving a file, prompt before overwriting an existing file of the same name. This is a default value for the Save dialog.
    • FOS_STRICTFILETYPES
      In the save dialog, only allow the user to choose a file that has one of the file extensions provided in IFileDialog::SetFileTypes.
    • FOS_NOCHANGEDIR
      Not used.
    • FOS_PICKFOLDERS
      Present the Open dialog offering a choice of folders rather than files.
    • FOS_FORCEFILESYSTEM
      Ensures that returned items are file system items (SFGAO_FILESYSTEM). Note that this does not apply to items returned by IFileDialog::GetCurrentSelection.
    • FOS_ALLNONSTORAGEITEMS
      Enables the user to choose any item in the Shell namespace, not just those with SFGAO_STREAM or SFAGO_FILESYSTEM attributes. This flag cannot be combined with FOS_FORCEFILESYSTEM.
    • FOS_NOVALIDATE
      Do not check for situations that would prevent an application from opening the selected file, such as sharing violations or access denied errors.
    • FOS_ALLOWMULTISELECT
      Enables the user to select multiple items in the open dialog. Note that when this flag is set, the IFileOpenDialog interface must be used to retrieve those items.
    • FOS_PATHMUSTEXIST
      The item returned must be in an existing folder. This is a default value.
    • FOS_FILEMUSTEXIST
      The item returned must exist. This is a default value for the Open dialog.
    • FOS_CREATEPROMPT
      Prompt for creation if the item returned in the save dialog does not exist. Note that this does not actually create the item.
    • FOS_SHAREAWARE
      In the case of a sharing violation when an application is opening a file, call the application back through IFileDialogEvents::OnShareViolation for guidance. This flag is overridden by FOS_NOVALIDATE.
    • FOS_NOREADONLYRETURN
      Do not return read-only items. This is a default value for the Save dialog.
    • FOS_NOTESTFILECREATE
      Do not test creation of the item returned in the save dialog. If this flag is not set, the calling application must handle errors such as denial of access discovered in the creation test.
    • FOS_HIDEMRUPLACES
      Hide the list of places from which the user has recently opened or saved items.
    • FOS_HIDEPINNEDPLACES
      Hide the list of pinned places from which the user can choose.
    • FOS_NODEREFERENCELINKS
      Shortcuts should not be treated as their target items, allowing an application to open a .lnk file.
    • FOS_DONTADDTORECENT
      Do not add the item being opened or saved to the recent documents list (SHAddToRecentDocs).
    • FOS_FORCESHOWHIDDEN
      Show hidden and system items.
    • FOS_DEFAULTNOMINIMODE
      Indicates to the Save As dialog box that it should open in expanded mode. Expanded mode is the mode that is set and unset by clicking the button in the lower-left corner of the Save As dialog box that switches between Browse Folders and Hide Folders when clicked.
    • FOS_FORCEPREVIEWPANEON
      Indicates to the Open dialog box that the preview pane should always be displayed.

Return Value

Returns S_OK if successful, or an error value otherwise.