Article View: borland.public.cppbuilder.nativeapi
Article #8824SHGetSpecialFolderLocation, Different results on WinXP and Win98
From: Jaepil Kim
Date: Tue, 21 Sep 2004 07:17
Date: Tue, 21 Sep 2004 07:17
72 lines
2641 bytes
2641 bytes
Hi i have following piece of code.
When i do:
GetSpecialFolderLocation(Application->Handle, CSIDL_DESKTOP, true)
On WinXP i get "C:\Documents and settings\Me\Desktop"
but on Win98 i get "Desktop"
What am i doing wrong?
//-------------------------------------------------------------
AnsiString GetSpecialFolderLocation(HANDLE AHandle, int SpecialFolder,
bool ForParsing)
{
// Local variables
PItemIDList l_DesktopPIDL;
TStrRet StrRet;
PChar P;
int Flags;
AnsiString * Result;
LPSHELLFOLDER IDesktopFolder;
bool l_FoundRequested;
// GetDesktop's ItemIDList
try {
OleCheck(SHGetSpecialFolderLocation(AHandle, SpecialFolder,
&l_DesktopPIDL));
l_FoundRequested = true;
} catch (...) {
l_FoundRequested = false;
}
if (l_FoundRequested == false) {
OleCheck(SHGetSpecialFolderLocation(AHandle, CSIDL_DESKTOP,
&l_DesktopPIDL));
}
OleCheck(SHGetDesktopFolder(&IDesktopFolder));
if (ForParsing) {
Flags = SHGDN_FORPARSING;
} else {
Flags = SHGDN_NORMAL;
}
IDesktopFolder->GetDisplayNameOf(l_DesktopPIDL, Flags, &StrRet);
switch (StrRet.uType)
{
case STRRET_CSTR:
Result = new AnsiString(StrRet.cStr, strlen(StrRet.cStr));
break;
case STRRET_OFFSET:
P = &l_DesktopPIDL->mkid.abID[StrRet.uOffset -
sizeof(l_DesktopPIDL->mkid.cb)];
Result = new AnsiString(P);
break;
case STRRET_WSTR:
Result = new AnsiString(StrRet.pOleStr);
break;
}
IDesktopFolder->Release();
return (*Result);
}
//-------------------------------------------------------------
Programer - SplashMedia
http://splashmedia.co.nz
Technical Details
Message-ID:
<414fd5ab$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b6d56e8c83c28a24,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 21 Sep 2004 19:17:59 +1200 From: Jaepil Kim <jaepil@splashmedia.co.nz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: SHGetSpecialFolderLocation, Different results on WinXP and Win98 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 202.0.52.53 Message-ID: <414fd5ab$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095751083 202.0.52.53 (21 Sep 2004 00:18:03 -0700) Lines: 72 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail