Getting Object Attributes

The attributes of each file object and folder determine, among other things, what actions can be carried out on the item. For instance, in the code that filled the tree view control, you needed to get object attributes to determine whether the item had subfolders or was a folder itself. To determine the attributes of a file object or a folder, an application uses the IShellFolder::GetAttributesOf member function. Table 14-1 lists some of the possible attributes of an object. (These attributes are defined in SHLOBJ.H.)

Attribute Flag Description
SFGAO_CANCOPY The object can be copied.
SFGAO_CANMOVE The object can be moved.
SFGAO_CANLINK The object can be linked.
SFGAO_CANRENAME The object can be renamed.
SFGAO_CANDELETE The object can be deleted.
SFGAO_HASPROPSHEET The object has a property sheet.
SFGAO_DROPTARGET The object is a drop target.
SFGAO_LINK The object is a shortcut.
SFGAO_SHARE The object is shared.
SFGAO_READONLY The object is read-only.
SFGAO_GHOSTED The object is displayed with a ghosted icon.
SFGAO_FILESYSANCESTOR The object contains a file system folder.
SFGAO_FOLDER The object is a folder.

Table 14-1. Examples of object attributes. (continued)

Attribute Flag Description
SFGAO_FILESYSTEM The object is a file system object (file/folder/root).
SFGAO_HASSUBFOLDER The object has a subfolder.
SFGAO_REMOVABLE Determines whether the object is removable media.