Article View: borland.public.cppbuilder.nativeapi
Article #13818Re: SpecialFolderLocation!
From: Remy Lebeau (TeamB)
Date: Tue, 16 Sep 2003 22:05
Date: Tue, 16 Sep 2003 22:05
65 lines
3155 bytes
3155 bytes
"Safari" <Safari@alloymail.com> wrote in message
news:3F67661C.4060309@alloymail.com...
> AnsiString __fastcall GetPaths(int Path)
> {
> PItemIDList idList;
> char idPath[MAX_PATH + 1] = {0};
> SHGetSpecialFolderLocation(0, Path, &idList);
> SHGetPathFromIDList(idList, idPath);
> CoTaskMemFree(idList);
> return String(idPath);
> }
Again and again, I suggest that you TEST THE RETURN VALUE of
SHGetSpecialFolderLocation() before calling SHGetPathFromIDList(). I don't
reiterate this point for my health, you know :-p.
AnsiString __fastcall GetPaths(int Path)
{
LPITEMIDLIST idList = NULL;
char idPath[MAX_PATH + 1] = {0};
AnsiString result;
if( SHGetSpecialFolderLocation(0, Path, &idList) == NOERROR )
{
if( SHGetPathFromIDList(idList, idPath) )
result = idPath;
CoTaskMemFree(idList);
}
return result;
}
> Program Files:
> Empty /* In Win98 (4.10.1998) */
> D:\Program Files /* In Win2K (5.0.2195) */
Correct. CSIDL_PROGRAM_FILES is not supported under Win9x. Look in the
Registry key I already told you about earlier.
> System:
> Empty /* In Win98 (4.10.1998) */
> D:\Win2K\System32 /* In Win2K (5.0.2195) */
Correct. CSIDL_SYSTEM is not supported under Win9x. Use the
GetSystemDirectory() function instead.
> Windows:
> Empty /* In Win98 (4.10.1998) */
> D:\Win2K /* In Win2K (5.0.2195) */
Correct. CSIDL_WINDOWS is not supported under Win9x. Use the
GetWindowsDirectory() function instead.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
Technical Details
Message-ID:
<3f6788ed$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!cox.net!news-xfer.cox.net!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3F63A478.1080901@alloymail.com> <3f639f01$1@newsgroups.borland.com> <3f63b367@newsgroups.borland.com> <3f63b711$1@newsgroups.borland.com> <3f64f6e9@newsgroups.borland.com> <3f64f99a$1@newsgroups.borland.com> <3f652cf8@newsgroups.borland.com> <3f65320b$1@newsgroups.borland.com> <3F67661C.4060309@alloymail.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,64d61a6d0b62f704 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-09-16 15:10:21 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3F63A478.1080901@alloymail.com> <3f639f01$1@newsgroups.borland.com> <3f63b367@newsgroups.borland.com> <3f63b711$1@newsgroups.borland.com> <3f64f6e9@newsgroups.borland.com> <3f64f99a$1@newsgroups.borland.com> <3f652cf8@newsgroups.borland.com> <3f65320b$1@newsgroups.borland.com> <3F67661C.4060309@alloymail.com> Subject: Re: SpecialFolderLocation! Date: Tue, 16 Sep 2003 15:05:27 -0700 Lines: 67 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f6788ed$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1063749869 207.175.226.26 (16 Sep 2003 15:04:29 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-05!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!green.readfreenews.net!news.readfreenews.net!cox.net!news-xfer.cox.net!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail