次の方法で共有


SHGNO (Compact 2013)

3/28/2014

This enumeration defines the values used with the IShellFolder::GetDisplayNameOf and IShellFolder::SetNameOf methods.

Syntax

typedef enum tagSHGDN {
  SHGDN_NORMAL,
  SHGDN_INFOLDER,
  SHGDN_FOREDITING,
  SHGDN_FORADDRESSBAR,
  SHGDN_FORPARSING
} SHGNO;

Elements

  • SHGDN_NORMAL
    Full name. The name is relative to the desktop computer and not to a specific folder. This value is used for generic display of the name of the specified file object or subfolder.
  • SHGDN_INFOLDER
    Relative name. The name is relative to the folder that is processing the name.
  • SHGDN_FOREDITING
    The name is used for in-place editing when the user renames the item.
  • SHGDN_FORADDRESSBAR
    The name is displayed in an address bar combo box.
  • SHGDN_FORPARSING
    The name is used for parsing. That is, it can be passed to IShellFolder::ParseDisplayName to recover the object's pointer to an item identifier list (PIDL). The form this name takes depends on the particular object.

Remarks

This enumeration consists of two groups of values. The first group - SHGDN_NORMAL and SHGDN_INFOLDER - specifies the name's type. The second group - SHGDN_FOREDITING, SHGDN_FORADDRESSBAR, and SHGDN_FORPARSING - consists of modifiers to the first group that specify name retrieval options.

If SHGDN_FORPARSING is set and SHGDN_INFOLDER is not set, IShellFolder::GetDisplayNameOf can accept a PIDL that contains more than an SHITEMID structure. Otherwise, only a single-level PIDL can be passed.

Although the parsing name returned by file system objects is the object's fully qualified path, virtual folders might use something quite different. For example, some virtual folders use a globally unique identifier (GUID) as the parsing name and return a string of the form "::{GUID}". To check whether the object is part of the file system, call IShellFolder::GetAttributesOf and see if the SFGAO_FILESYSTEM flag is set. If you are implementing IShellFolder::GetDisplayNameOf, you are encouraged to return parsed names that are as close to the display names as possible. This practice helps the end user to type or edit these names.

The numeric value of SHGDN_NORMAL is zero, so you cannot test for the presence of this bit. Consider SHGDN_NORMAL a default setting that is used if no other flag in that group is set.

Example

The following tables show an example of possible return values for five different flag options and three different item types.

The following table shows the flag options.

Number

Flags

Description

1

SHGDN_NORMAL | SHGDN_FORPARSING

Returns the fully qualified parsing name.

2

SHGDN_INFOLDER | SHGDN_FORPARSING

Returns the parsing name relative to the parent folder.

3

SHGDN_INFOLDER | SHGDN_FOREDITING

Returns the editing name relative to the parent folder.

4

SHGDN_INFOLDER

Returns the display name relative to the parent folder.

5

SHGDN_NORMAL

Returns the display name relative to the desktop.

The following table shows the sample item types.

Letter

Description

A

A printer named Laser on a computer called Mailroom.

B

The file C:\Directory\File.txt (when file name extensions are hidden).

The following table shows the display names, as they would be returned.

Number

A

B

1

\\Mailroom\Laser

C:\Directory\File.txt

2

Laser

File.txt

3

Laser

File

4

Laser

File

5

Laser on Mailroom

File

Remarks about examples:

  • A1-A5: The display name of the remote printer changes depending on whether it is being shown relative to its parent. When shown relative to its parent, only the printer name is needed, but when shown outside its parent, both the printer name and computer name are needed.
  • B3: File.txt presents only its base name for editing instead of its full name.

Requirements

Header

shobjidl.h,
shobjidl.idl

See Also

Reference

Shell Enumerations
IShellFolder
SHGetDesktopFolder