Article View: borland.public.cppbuilder.nativeapi
Article #1996Re: Getting the location of My Documents
From: Bob Gonder
Date: Fri, 25 May 2007 18:44
Date: Fri, 25 May 2007 18:44
33 lines
2404 bytes
2404 bytes
JB wrote: >I need to get the pathname for the user's My Documents folder. >Initially I used SHGetFolderLocation, with CSIDL_PERSONAL this >works ok until the user is logged onto a network and it returns >a location on the server that is a personal folder set up for >the user. >I have tried using the parameter CSIDL_MYDOCUMENTS but on a >standalone PC it gives a pidl of null. >What is the best way to get the location of the My Documents >folder on the hard drive of the PC? From the help: <help> Once your application has the My Documents PIDL, it can handle the folder just as it would a normal file system folder: enumerating items, parsing, binding, and performing any other valid folder operations. The Shell automatically maps changes in My Documents or its subfolders to the appropriate file system folders. If your application needs access to the actual file system folder that contains the current user's documents, pass CSIDL_PERSONAL to SHGetFolderLocation. The function returns the PIDL of the file system folder that is displayed in the current user's My Documents folder. </help> From this it sounds like you can use the MyDoc PIDL for shell operations, but if you want to use "normal" file functions, you need to use Personal. I don't think that there is any guarantee that MyDocuments physically exists on the local machine. It would be so much easier to backup/enforce retention rules if all documents existed on the server.
Technical Details
Message-ID:
<atae53t6moj47760cab9h1uqqoj1vo3e29@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4656efa1$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,9503052ea4e0798c X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Getting the location of My Documents Date: Fri, 25 May 2007 11:44:28 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <atae53t6moj47760cab9h1uqqoj1vo3e29@4ax.com> References: <4656efa1$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.77.147.10 X-Trace: newsgroups.borland.com 1180118666 67.77.147.10 (25 May 2007 11:44:26 -0700) Lines: 35 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail