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

    Environment.SpecialFolder.Personal (C#) & CSIDL_PERSONAL (C++) Problem, Win 7

    So I redirected My Documents folder in Win 7. To D:\.

    Now I want to get the My Documents folder in a C# app and in a C++ game, I want to get the same file in the same My Documents folder. So I'm doing this:

    C++:
    CODE
    SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_DEFAULT, path);

    And I get: path = "C:\Users\DAaaMan64\Documents"

    C#:
    CODE
    string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

    And I get: path = "D:\\"

    ^^ that is the redirected My Documents folder.

    As far as I'm concerned this is a bug.

    I'm about ready to just pipe it to the child process. What am I doing wrong?

    Thanks.

  2. #2
    Join Date
    Oct 2009
    Posts
    5

    Re: Environment.SpecialFolder.Personal (C#) & CSIDL_PERSONAL (C++) Problem, Win 7

    Problem solved, should be using SHGFP_TYPE_CURRENT instead of SHGFP_TYPE_DEFAULT

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