🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14762

Re: Localized name for My Documents

#14762
From: Bob Gonder
Date: Fri, 01 Aug 2003 18:59
54 lines
2843 bytes
Remy Lebeau (TeamB) wrote:

>
>"Martin Nijhoff" <m.NOSPAMnijhoff@tba-tenNOSPAM.nl> wrote in message
>news:3f291bf5@newsgroups.borland.com...
>
>> I use SHGetSpecialFolderLocation() to get the PIDL to the folder. With
>> IShellFolder::GetDisplayNameOf() I can only get the file path to the
>folder
>> (which is D:\Docs in my case), but not the name that is used to display My
>> Documents (or Mijn Documenten in dutch, Eigene Dateien in german, etc.) in
>> for example Start | Recent Docs.
>
>What does your actual code look like?  When you called GetDisplayNameOf(),
>what actual value did you pass to uFlags parameter?  Did you use
>SHGDN_NORMAL, SHGDN_INFOLDER, or SHGDN_FORPARSING.
>
>
>Gambit

This bit from the PrintStrRet() sample code:

        case STRRET_WSTR: 
            cch = WideCharToMultiByte(CP_OEMCP, WC_DEFAULTCHAR, 
		lpStr->DUMMYUNIONNAME.pOleStr, -1,NULL, 0,NULL,NULL);

cch returns 0 even though pOleStr is a wide string of "My Documents".
So, the sample code is actually returning the proper string, but the
display function isn't working.
This is my code that gives the proper widestring:
Note: I'm only interested in the path, pidltest was added for this
exercise.

if( NOERROR == SHGetSpecialFolderLocation( hWnd,CSIDL_PERSONAL,&pidl))
{
	if( !SHGetPathFromIDList( pidl, filepath ) )
	{	lstrcpy( filepath, "c:\\My Documents"); 
	};
#if pidltest
	if( SUCCEEDED(SHGetDesktopFolder(&pFolder)) )
	{
		if(
		     SUCCEEDED(pFolder->lpVtbl->GetDisplayNameOf(
	                        pFolder, pidl, SHGDN_INFOLDER, 
				&sName)) )
 
			    PrintStrRet(pidl, &sName);

		if (pFolder != NULL)
		                pFolder->lpVtbl->Release(pFolder); 
	};
#endif
	pShellMalloc->lpVtbl->Free(pShellMalloc,pidl);
};
Technical Details
Message-ID: <0vcliv8blik8ppbn2vr5rq7v3rvpq5elge@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f291bf5@newsgroups.borland.com> <3f2a9ab0@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a8f8c57e6feba365
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-01 12:06:25 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Localized name for My Documents
Date: Fri, 01 Aug 2003 11:59:06 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <0vcliv8blik8ppbn2vr5rq7v3rvpq5elge@4ax.com>
References: <3f291bf5@newsgroups.borland.com> <3f2a9ab0@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.164.94
X-Trace: newsgroups.borland.com 1059764346 67.31.164.94 (1 Aug 2003 11:59:06 -0700)
Lines: 56
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail