🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Please Pb with folder with Vista

#751
From: Remy Lebeau (TeamB)
Date: Thu, 24 Jan 2008 18:34
59 lines
2890 bytes
"patrickartaud" <patrickartaud@aidedecision.com> wrote in message 
news:4798bade@newsgroups.borland.com...

> I use this code :
<snip>

There are some potential bugs in that code.  Try this instead:

    LPITEMIDLIST List = NULL;
    AnsiString Full;

    if( SHGetSpecialFolderLocation(0, CSIDL_APPDATA, &List) == 0 )
    {
        char Path[MAX_PATH+1] = {0};
        if( SHGetPathFromIDList(List, Path) )
        {
            Full = IncludeTrailingBackslash(Path) + societe;
            ForceDirectories(Full);
        }
    }

    ChVista = Full;

> It is ok I have
> Document and setting\Patrick\Application Data in ChVista

Under Vista, CSIDL_APPDATA it should be returning the complete path to the 
user's "Roaming" folder.  Vista doesn't even have a "Document and Settings" 
folder like XP did.

> But when I launch my application it put the folders and subfolders
> in Document and setting\Patrick\Application Data\Roaming

That is what it is supposed to do.  The "Roaming" folder is the actual 
CSIDL_APPDATA folder under Vista.  Refer to MSDN for details:

    CSIDL
    http://msdn2.microsoft.com/en-us/library/bb762494.aspx

    KNOWNFOLDERID
    http://msdn2.microsoft.com/en-us/library/bb762584(VS.85).aspx

Under Vista, you should be using KNOWNFOLDERIDs instead of CSIDLs now.

> And my application dont find the folders.

Please show your actual code for accessing the files.  The path returned by 
SHGetSpecialFolderLocation() is a valid folder path and should be used as-is 
with whatever subfolders you need to add to it.  When your code fails, you 
are probably not actually accessing the folder you think you are accessing.

> I don't understand why it add this subfolder Roaming because in
> ChVista it stop at application data or it is a wrong CSIDL?

That is likely Vista's "Folder Redirection" feature at work.


Gambit 
Technical Details
Message-ID: <4798da20$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4798bade@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7ff0773a78f53a87
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4798bade@newsgroups.borland.com>
Subject: Re: Please Pb with folder with Vista
Date: Thu, 24 Jan 2008 10:34:58 -0800
Lines: 61
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <4798da20$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1201199648 207.178.157.90 (24 Jan 2008 10:34:08 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail