Getting the user's 'My Documents' folder
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Getting the user's 'My Documents' folder

  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    Getting the user's 'My Documents' folder

    Is there a simple API call to obtain the current user's 'My Documents' folder? I know about SHGetSpecialFolderLocation() but for some strange reason it requires a HWND as the first parameter (not sure if it can be NULL). I also know there are (mostly convoluted) ways of finding this info from the registry - but I just wondered if there's anything a bit more straightforward?
    "A problem well stated is a problem half solved. - Charles F. Kettering

  2. #2
    Join Date
    Jul 2002
    Posts
    2,512

    Re: Getting the user's 'My Documents' folder

    SHGetSpecialFolderLocation is obsolete, use SHGetFolderPath with CSIDL_PERSONAL. hwndOwner parameter can be NULL.

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Getting the user's 'My Documents' folder

    Yes, but that can be NULL. See SHGetFolderPath() also.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: Getting the user's 'My Documents' folder

    Not sure if this will help as it doesn't give you the "My Documents" folder, however it can point you to the user data area...

    Take a look at the environment variables:
    APPDATA
    HOMEDRIVE and HOMEPATH
    USERPROFILE

    They will point you to where the user specific items are stored.

    Hope it helps.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center