If you use IFileDialog
with the FOS_
flag, or SHBrowseForFolder
with the BIF_
flag, the dialog nevertheless shows non-filesystem folders, and if users pick one, they are told “You can’t save here.” Why show users folders that they can’t pick?
Because they may need to pass through these unpickable folders in order to get something that they can pick.
If the folder picker dialogs suppressed unpickable folders, then that would make it impossible to pick any of you local drives because they all live inside the unpickable “This PC” node!
Each IShellFolder
can report that an item could potentially lead to a file system location by setting the SFGAO_
attribute. If that attribute is reported, then the item will appear in the file picker dialogs. It may not itself be pickable, but it needs to be shown because it potentially leads to pickable items.
I enabled FOS_FORCEFILESYSTEM option but I still can select “3D Objects” folder.
Is this an ordinary folder?
The KNOWNFOLDERID documentation states that FOLDERID_Objects3D has a path. It is likely that it is being shown because it can have a path even though it doesn’t exist by default these days.
thank you;
It’s special in the same way your pictures folder is special.
thank you.
Thank you. I didn’t even know such an option exists.
This makes sense but will a folder be hidden if it contains only non-filesystem items (recursively)? While the mechanism has a logical explanation, it is still unclear it is useful.
Yes. If a folder is purely virtual, then it will be suppressed. For example you don’t see Control Panel. The ones that are shown are those that declare themselves to be SFGAO_FILESYSANCESTOR. “I am myself a file system folder, or I have a descendant that is a file system folder.”
>will a folder be hidden if it contains only non-filesystem items (recursively)?
>Yes.
>... I have a descendant that is a file system folder.
I would be very surprised if that were the case. My understanding is that a folder is hidden if it cannot contain file-system folders, which is a separate concept from whether it currently has a descendant that is a file-system folder. I'm not sure if network shares are part of the file...
The docs for SFGAO_FILESYSANCESTOR say "The specified folders are either file system folders or contain at least one descendant (child, grandchild, or later) that is a file system (SFGAO_FILESYSTEM) folder."
It's up to the provider to make that determination, of course, and some providers could decide to take the easy way out and say "I could, therefore I do" rather than actually keeping track, but the docs are pretty clear about what it's supposed to mean.
It’s just a UI guide. In practice, it’s “contains or could contain”, because it’s possible that a file system child item appears dynamically while the dialog is open, so you need to be there just in case.
I would say it is a documentation bug, because it is illogical and "Network" indeed works as I anticipated. Turn off network discovery, access Network once, then run the following code. When file-system folders are forced, Network is shown (not selectable) even if it currently contains no selectable items, and Control Panel is not shown; when file-system folders are not forced, Network is shown (selectable) and Control Panel is shown.
<code>
Caching is a possible issue if the folder is dynamic regarding this flag.
See the documentation for SFGAO_HASSUBFOLDER, if that flag is not set you can be 100% sure there are no subfolders. If the flag is set, maybe it does.