Compartilhar via


IShellFolder::GetAttributesOf (Compact 2013)

3/28/2014

This method retrieves the attributes of one or more file objects or subfolders.

Syntax

HRESULT GetAttributesOf(
  UINT cidl,
  LPCITEMIDLIST* apidl,
  SFGAOF* rgfInOut
);

Parameters

  • cidl
    [in] Number of file objects from which to retrieve attributes.
  • apidl
    [in] Address of an array of pointers to ITEMIDLIST structures, each of which uniquely identifies a file object relative to the parent folder. Each ITEMIDLIST structure must contain exactly one SHITEMID structure followed by a terminating zero.
  • rgfInOut
    [in, out] Address of a single ULONG value that, on entry, contains the attributes that the caller is requesting. On exit, this value contains the requested attributes that are common to all of the specified objects. This is the address of a single ULONG value, not an array of ULONG values. See Remarks for possible values.

Return Value

Returns NOERROR if successful, or an error value otherwise.

Remarks

The following attributes are valid for the rgfInOut parameter.

A file object's capability flags may be zero or a combination of values shown in the following table.

Flag (value)

Description

SFGAO_CANCOPY (0x00000001)

The specified file objects or folders can be copied (same value as the DROPEFFECT_COPY flag).

SFGAO_CANDELETE (0x00000020)

The specified file objects or folders can be deleted.

SFGAO_CANLINK (0x00000004)

Shortcuts can be created for the specified file objects or folders. This flag has the same value as DROPEFFECT. The typical use of this flag is to add a Create Shortcut item to the shortcut menu that is displayed during drag-and-drop operations. However, SFGAO_CANLINK also adds a Create Shortcut item to the Windows Explorer File menu, and to typical shortcut menus. If this item is selected, your application's IContextMenu::InvokeCommand interface is invoked with the lpVerb member of the CMINVOKECOMMANDINFO structure set to "link". Your application is responsible for creating the link.

SFGAO_CANMONIKER (0x00400000)

It is possible to create monikers for the specified file objects or folders.

SFGAO_CANMOVE (0x00000002)

The specified file objects or folders can be moved (same value as the DROPEFFECT_MOVE flag).

SFGAO_CANRENAME (0x00000010)

The specified file objects or folders can be renamed. This flag is essentially a suggestion. It does not guarantee that a namespace client will rename the file or folder object.

SFGAO_CAPABILITYMASK (0x00000177)

A mask for the capability flags.

SFGAO_DROPTARGET (0x00000100)

The specified file objects or folders are drop targets.

SFGAO_HASPROPSHEET (0x00000040)

The specified file objects or folders have property sheets.

A file object's display attributes may be zero or a combination values shown in the following table.

Flag (value)

Description

SFGAO_DISPLAYATTRMASK (0x000F0000)

A mask for the display attributes.

SFGAO_GHOSTED (0x00080000)

The specified file objects or folders should be displayed using a ghosted icon.

SFGAO_LINK (0x00010000)

The specified file objects are shortcuts.

SFGAO_READONLY (0x00040000)

The specified file objects or folders are read-only.

SFGAO_SHARE (0x00020000)

The specified folders are shared.

SFGAO_DISPLAYATTRMASK (0x000F0000)

A mask for the display attributes.

A file object's contents flags may be zero or a combination values shown in the following table.

Flag (value)

Description

SFGAO_CONTENTSMASK (0x80000000)

A mask for the contents attributes.

SFGAO_HASSUBFOLDER (0x80000000)

The specified folders may have subfolders, and are therefore expandable in the left pane of Windows Explorer.

The SFGAO_HASSUBFOLDER attribute is only advisory, and may be returned by shell folder implementations even if they do not contain subfolders. Returning SFGAO_HASSUBFOLDER is recommended whenever a significant amount of time is required to determine whether any subfolders exist. For example, the shell always returns SFGAO_HASSUBFOLDER when a folder is located on a network drive.

A file object's miscellaneous attributes may be zero or a combination values shown in the following table.

Flag (value)

Description

SFGAO_BROWSABLE (0x08000000)

The specified items can be browsed in place.

SFGAO_COMPRESSED (0x04000000)

The specified items are compressed.

SFGAO_FILESYSTEM (0x40000000)

The specified folders or file objects are part of the file system (that is, they are files, directories, or root directories).

SFGAO_FILESYSANCESTOR (0x10000000)

The specified folders contain one or more file system folders.

SFGAO_FOLDER (0x20000000)

The specified items are folders.

SFGAO_NEWCONTENT (0x00200000)

The objects contain new content.

SFGAO_NONENUMERATED (0x00100000)

The items are not enumerated.

SFGAO_REMOVABLE (0x02000000)

The specified file objects or folders are on removable media.

SFGAO_VALIDATE (0x01000000)

Validate cached information. The shell confirms that the objects specified in apidl still exist and does not use cached information when retrieving the attributes. If one or more of the items specified in apidl no longer exist, this method returns an error code. If cidl is zero, the shell discards all cached information for the shell folder. This is similar to doing a refresh of the folder.

You can optimize this operation by not returning unspecified flags.

Requirements

Header

shobjidl.h,
shobjidl.idl

Library

Developer Implemented

See Also

Reference

IShellFolder
ITEMIDLIST
SHITEMID