πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by patrickartaud Thu, 24 Jan 2008 16:20
Please Pb with folder with Vista
#749
Author: patrickartaud
Date: Thu, 24 Jan 2008 16:20
38 lines
2598 bytes
Hello
I have created an application running with XP but now I must change the code 
because my application creates folders and subfolders with files IFor the 
user for the exemple it is me "Patrick"
I use this code :
/////////////////////////////////////////////////////////////////////////////////
LPITEMIDLIST List=NULL;
AnsiString Full,Fi,FN;

char Path[MAX_PATH+1]={0};
if(!SHGetSpecialFolderLocation(0,CSIDL_APPDATA,&List))
        {
        if(SHGetPathFromIDList(List,Path))
                {Fi=Path;
                FN=societe;
                Full=Fi+FN;
                strcpy(Path,Full.c_str());
                CreateDir(Full);
                }
        }
ChVista=Full
/////////////////////////////////////////////////////////////////
It is ok I have
Document and setting\Patrick\Application Data in ChVista
But when I launch my application it put the folders and subfolders in
Document and setting\Patrick\Application Data\Roaming
And my application dont find the folders.
I have look on halp for LPITEMIDLIST and SHGetSpecialFolderLocation and on 
the net I have past long time to find and try to understand but nothing, I 
don't arrive to do it correctly.
If somebody can help me or somebody have had the same problem to modify the 
code help me please
I don't understand why it add this subfolder Roaming because in ChVista it 
stop at application data or it is a wrong CSIDL?but I have look.
I don't understand how to do.
I thank you very very much for your help in advance
Patrick
PS:Excuse my English 
Re: Please Pb with folder with Vista
#751
Author: 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 
Re: Please Pb with folder with Vista
#515
Author: patrickartaud
Date: Fri, 25 Jan 2008 16:54
76 lines
3859 bytes
Thank you very much for all this I go to look at.
Whan I need "mine folders or subfolders where they are .db Files I use the 
same code for the start of the .cpp of a .dll and after I use
extern Ansi ChVista for all the cpp files of the .exe or dll.
And did it work for XP too?Thank you Or I must have a XP version an Vista 
version?
And please where could I find enougth simplist explanations for Vista 
because I have tried in "msdn" and in all page there are a lot off links and 
I don't know where to go or there is only this mean?
Thank you again
Best Regards
Patrick Artaud
PS: Re Excuse me for my English (I try!!!!)
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> a οΏ½crit dans le message de 
news:4798da20$1@newsgroups.borland.com...
>
> "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
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads