Shell items have a bunch of attributes. For example, SFGAO_FOLDER means that the item is a folder, and it will show up in the navigation pane as a folder. Since it’s a folder, you can bind to it and enumerate children. But what if you need more information about what kind of folder it is?
The other attributes SFGAO_FILESYSTEM, SFGAO_FILESYSANCESTOR, and SFGAO_STREAM can help you distinguish the various scenarios.
The SFGAO_FILESYSTEM attribute means that the item exists in the file system, and the parsing name for a SFGAO_FILESYSTEM object can be used to access the corresponding entity in the file system.
The SFGAO_FILESYSANCESTOR attribute means that the item or one of its children might have the SFGAO_FILESYSTEM attribute. This attribute is used by the File Open and File Save dialogs, for example, to decide whether to filter out the item. If it’s possible to reach the file system via the item, then the File Open and File Save dialogs will include the item. You may not be able to save directly to the item (such as My Computer), but it will let you navigate through it on the way to something you can save to.
The SFGAO_STREAM attribute means that the item can produce bytes of data. If combined with the SFGAO_FILESYSTEM attribute, it means that the underlying storage for the item is a file. Even though the underlying storage is a file system file, it may be exposed in the shell namespace as a folder. For example, ZIP files are file system files, but they show up in the shell namespace as a folder, so that you can open them up and drag files into or out of them.
Let’s summarize this in a chart.
SFGAO_FILESYSTEM? |
SFGAO_FOLDER? |
SFGAO_STREAM? |
Result | Example |
|---|---|---|---|---|
| Virtual file with no data | Dial-up networking connectoid | |||
SFGAO_STREAM |
Virtual file with data | File on an FTP site | ||
SFGAO_FOLDER |
Virtual folder | Control Panel | ||
SFGAO_FOLDER | |
SFGAO_STREAM |
Virtual folder with data | ? | |
SFGAO_FILESYSTEM |
File system file with no data | Symbolic link | ||
SFGAO_FILESYSTEM | |
SFGAO_STREAM |
File system file with data | Traditional file system file | |
SFGAO_FILESYSTEM | |
SFGAO_FOLDER |
File system directory | Traditional file system directory | |
SFGAO_FILESYSTEM | |
SFGAO_FOLDER | |
SFGAO_STREAM |
Virtual directory inside a file system file | ZIP file |
I couldn’t think of an example of a virtual folder with data.
0 comments