🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: AccessVialoation on SHGetSpecialFolderLocation

#5539
From: Jonathan Benedicto
Date: Fri, 05 Aug 2005 21:34
27 lines
1718 bytes
"George Francis" <george_f@hotmail.com> wrote in message 
news:42f3d881$1@newsgroups.borland.com...
> Hello, I am trying to use the following code to read the user's Send To 
> directory:
>
>   char cBuf[MAX_PATH];
>   LPITEMIDLIST pidl;
>   SHGetSpecialFolderLocation(0, CSIDL_SENDTO, &pidl);
>   SHGetPathFromIDList(pidl, cBuf);
>
> It compiles OK, but I get an access violation Exception on the call to 
> SHGetSpecialFolderLocation.
> Can anyone suggest why?

No, but maybe you might want to use this code instead:

AnsiString __fastcall GetSpecialPath(int Folder)
{
    char Path[MAX_PATH + 1] = { 0 };
    if( ::SHGetSpecialFolderPath( NULL, Path, Folder, 0 ) )
        return AnsiString( Path );
    return "";
}

GetSpecialPath( CSIDL_SENDTO );

Jonathan 
Technical Details
Message-ID: <42f3db7c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42f3d881$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7f4466ab7adf1876
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Jonathan Benedicto" <incorrect@no.server>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42f3d881$1@newsgroups.borland.com>
Subject: Re: AccessVialoation on SHGetSpecialFolderLocation
Date: Fri, 5 Aug 2005 17:34:53 -0400
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 69.158.98.105
Message-ID: <42f3db7c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1123277692 69.158.98.105 (5 Aug 2005 14:34:52 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail