Microsoft KB Archive/198871

{|
 * width="100%"|

PRB: IShellFolder::GetDisplayNameOf Returns Names with GUIDs

 * }

Q198871

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK), on platform(s):
 * the operating system: Microsoft Windows NT
 * the operating system: Microsoft Windows 2000

-

SYMPTOMS
On Windows 2000, calling the desktop's IShellFolder::GetDisplayNameOf with SHGDN_FORPARSING for a namespace extension returns a name with GUIDs in it rather than actual display names.

For example, the following code:

LPITEMIDLIST  pidl = NULL;

SHGetSpecialFolderLocation(NULL, CSIDL_CONTROLS, &pidl);

if(pidl) {  IShellFolder   *pDesktop;

SHGetDesktopFolder(&pDesktop); if(pDesktop) {     STRRET   str; TCHAR   szText[MAX_PATH];

pDesktop->GetDisplayNameOf(  pidl,                                     SHGDN_FORPARSING,                                     &str);

pDesktop->Release; }  } returns a name such as:



rather than the following expected text:

Control Panel

Some folders may return a name such as:

My Computer\::{GUID for the requested item}

instead of returning the GUID for "My Computer."

CAUSE
This behavior is due to a design change in the Windows 2000 desktop.

RESOLUTION
To retrieve the actual display text, you need to add the SHGDN_FORADDRESSBAR flag to the SHGDN_FORPARSING flag. If this is done in the sample code above, the text returned will be:

"Control Panel"

STATUS
This behavior is by design.

Additional query words:

Keywords : kbNameSpace kbOSWinNT400 kbOSWin2000 kbSDKPlatform kbSDKWin32 kbGrpDSShell

Issue type : kbprb

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch