CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005
    Posts
    399

    Question Finding exact path of 'My documents' folder

    Hi all,

    This is what I do to find the exact path of 'My documents' folder on any XP machine. But it fails on some XP systems.

    Code:
    CRegKey regKey;
    
    regKey.Open(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders")
    regKey.QueryValue(NULL,"Personal",&dwValData);
    sMyDocumentsPath = (char *)malloc(dwValData);
    regKey.QueryValue(sMyDocumentsPath,"Personal",&dwValData)
    Can there be any flaws in the above technique?
    Last edited by leojose; September 9th, 2005 at 09:07 AM.

  2. #2
    Join Date
    Apr 2002
    Location
    PA, USA
    Posts
    1,658

    Re: Finding exact path of 'My documents' folder

    SHGetSpecialFolderPath is the function you wanna use:
    http://msdn.microsoft.com/library/de...folderpath.asp

    The list of CLSIDs:
    http://msdn.microsoft.com/library/de...nums/csidl.asp

    Edit: for examples of how to use it... use google or the code guru forum. There are quite a few articles (found with both search engines) that will help you use this function. But it's pretty easy to use. Chances are you'll pass NULL for the first param, and the rest are self explanatory (hopefully )

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured