Display Names and Filenames

Because item identifiers are binary data structures, each item in a shell folder also has a display name, which is a string that can be shown to the user. You can use member functions in the IShellFolder interface to retrieve an item's display name, to find an item with the specified display name, or to change an item's display name.

The IShellFolder::GetDisplayNameOf member function can be used to retrieve a display name. The actual string returned depends on the type of display name specified. Values identifying the different types of display names are defined by the SHGNO enumerated type and have the SHGDN prefix. The type of display name that an application requests might depend on whether an item is shown by itself or within its parent folder. (A shared directory might be labeled Public on 'bill' in the former case and simply Public in the latter case.)

A special type of display name is one that can be converted back to an item identifier by using the IShellFolder::ParseDisplayName member function. You might use this type of display name as a parameter to the ShellExecute function or as a command-line argument for an application. For items within the file system, the display name for parsing is the same as the file system path. You can also convert a PIDL to a file system path by using the SHGetPathFromIDList function.

The IShellFolder::SetNameOf member function can be used to change the display name of a file object or subfolder. Changing an item's display name also changes its item identifier, so the function returns a PIDL containing the new item identifier. For file objects or folders within the file system, changing the display name renames the file or directory.