Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Querying CSIDL_PERSONAL returns NULL

164 views
Skip to first unread message

sridharn

unread,
Aug 19, 2009, 3:35:09 PM8/19/09
to
Hi,
In my program , I need the path where My Documents is installed on
my machine which is newly configured( An empty My Documents folder
because windows was just installed) . I queried CSIDL_PERSONAL
using SHGetSpecialFolderPath that returns NULL.So I need an alternate
solution for finding out My Documents path in a machine that is newly
configured.

Please let me know if there is any alternate CSIDL variables that I
can query or any registry entry that I can query which will return the
My Documents path.

Thanks in Advance ,
Sridhar.

Nathan Mates

unread,
Aug 19, 2009, 3:45:54 PM8/19/09
to
In article <9062ead6-f737-469f...@b25g2000prb.googlegroups.com>,

sridharn <sreed...@gmail.com> wrote:
> In my program , I need the path where My Documents is installed on
>my machine which is newly configured( An empty My Documents folder
>because windows was just installed) . I queried CSIDL_PERSONAL
>using SHGetSpecialFolderPath that returns NULL.So I need an alternate
>solution for finding out My Documents path in a machine that is newly
>configured.

Why not look at the documentation for that function -- at
http://msdn.microsoft.com/en-us/library/bb762204%28VS.85%29.aspx --
and see if there's a flag that might just be really useful when the
path doesn't already exist.

Nathan Mates

--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein

sridharn

unread,
Aug 19, 2009, 4:00:42 PM8/19/09
to
On Aug 19, 12:45 pm, nat...@visi.com (Nathan Mates) wrote:
> In article <9062ead6-f737-469f-b07b-d80cd2828...@b25g2000prb.googlegroups.com>,

>
> sridharn  <sreedhar...@gmail.com> wrote:
> >   In my program , I need the path where My Documents is installed on
> >my machine which is newly configured( An empty My Documents folder
> >because windows was just installed) .       I queried CSIDL_PERSONAL
> >using  SHGetSpecialFolderPath that returns NULL.So I need an alternate
> >solution for finding out My Documents path in a machine that is newly
> >configured.
>
>    Why not look at the documentation for that function -- athttp://msdn.microsoft.com/en-us/library/bb762204%28VS.85%29.aspx--
> and see if there's a flag that might just be really useful when the
> path doesn't already exist.
>
> Nathan Mates
>
> --
> <*> Nathan Mates - personal webpagehttp://www.visi.com/~nathan/ 
> # Programmer at Pandemic Studios --http://www.pandemicstudios.com/

> # NOT speaking for Pandemic Studios. "Care not what the neighbors
> # think. What are the facts, and to how many decimal places?" -R.A. Heinlein

Hi ,
I need the flag only if I need to create a folder when the path
that does not exist. In this case , the My documents path exists( with
no files in it ) and there is no effect of turning on and off the
flag .

I am looking for alternate shell functions / CSIDL variables or
regtistry entries that will provide me with the My documents path.

Thhanks,
Sridhar.

Piranha

unread,
Aug 19, 2009, 7:01:38 PM8/19/09
to
> Sridhar.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

1) There is no need for "Special"

SHGetFolderPath();

will do just fine.

2) You don´t have to check whether or not a folder already exists,
simply create it either way, that will make the folder if it not
exists, or skip the command if it already exists.

The following is for UNICODE (wstring) if your application needs ANSI
you have to convert it.

TCHAR szPath[MAX_PATH];
if(SUCCEEDED(SHGetFolderPath(0,CSIDL_PERSONAL,0,0,szPath)))
{
wstring BasePath(szPath);
wstring documentspath = BasePath + L"\\MyProgram";
CreateDirectory(documentspath.c_str(),0);
}


0 new messages