IShellFolder::GetDisplayNameOf method
Retrieves the display name for the specified file object or subfolder.
Syntax
Parameters
- pidl [in]
Type: PCUITEMID_CHILD
PIDL that uniquely identifies the file object or subfolder relative to the parent folder.
- uFlags [in]
Flags used to request the type of display name to return. For a list of possible values, see the SHGDNF enumerated type.
- pName [out]
When this method returns, contains a pointer to a STRRET structure in which to return the display name. The type of name returned in this structure can be the requested type, but the Shell folder might return a different type.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
It is the caller's responsibility to free resources allocated by this function.
Normally, pidl can refer only to items contained by the parent folder. The PIDL must be single-level and contain exactly one SHITEMID structure followed by a terminating zero. If you want to retrieve the display name of an item that is deeper than one level away from the parent folder, use SHBindToParent to bind with the item's immediate parent folder and then pass the item's single-level PIDL to IShellFolder::GetDisplayNameOf.
Also, if the SHGDN_FORPARSING flag is set in uFlags and the SHGDN_INFOLDER flag is not set, pidl can refer to an object at any level below the parent folder in the namespace hierarchy. At one time, pidl could be a multilevel PIDL, relative to the parent folder, and could contain multiple SHITEMID structures. However, this is no longer supported and pidl should now refer only to a single child item.
The simplest way to retrieve the display name from the structure pointed to by pName is to pass it to either StrRetToBuf or StrRetToStr. These functions take a STRRET structure and return the name. You can also examine the structure's uType member, and retrieve the name from the appropriate member.
The flags specified in uFlags are hints about the intended use of the name. They do not guarantee that IShellFolder will return the requested form of the name.. This occurrence is exceptional, but you should check to be sure.
Requirements
See also