%MyDocumentsDir%

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Option_Explicit
    Forum Member
    • Oct 2002
    • 54

    %MyDocumentsDir%

    I'll ask this same question again, just a different way..
    I need to see how this built in variable "%MyDocumentsDir%" was made, I need to be able to access users "favorites" directory in Win2k & XP so to modify this variable or recreate another one.
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3971

    #2
    Re: %MyDocumentsDir%

    You could trim the "My Documents" out of the path and append the "Favorites". This would be making the assumption that the user has not changed the path of their "My Documents" folder.

    The best bet would be to use the USER32.DLL's SHGetSpecialFolderLocation function. The thing is that I don't think you can directly call it from AMS because the parameters are not passed By Value.

    If you wanted I could maybe write a DLL that would be a wrapper for AMS to obtain the folder info. No promises though, my C++ skills are limited, I'm more of a VB person.

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      Re: %MyDocumentsDir%

      Curiosity got the best of me and I decided to see how hard it would be. It wasn't that bad, so here it is...

      Download Here.

      Comment

      • Option_Explicit
        Forum Member
        • Oct 2002
        • 54

        #4
        Re: %MyDocumentsDir%

        yea...last night I come up with that idea of using the string from %MyDocumentsDir% and do a "string.replace" and I was getting around pretty good, thing is it was only good for the 1 user you was logged in with. In XP theres a registry key "DocFolderPaths" that hold all the user names, but only if there are more than 1, and I didnt see that key in win2000 , I'll play around with that .dll although it looks as if it is current user dependent as well thanks for the Idea

        Comment

        • Worm
          Indigo Rose Customer
          • Jul 2002
          • 3971

          #5
          Re: %MyDocumentsDir%

          It will only give you the information on the current user. But at least it will be the correct information. As I said before, if someone changes their My Documents folders location, the %MYDocuments% trick will return a bad path. I don't know how common it is to do this, but I do know the company I work for changes it so that all documents are held on the server for backup purposes.

          Something you might need to think about when trying to put the info into the other's folders. Permissions! In NT/2000/XP the user running the program may not have permission on the other user's folders.

          Not knowing exactly what you're trying to accomplish, you might want to set a registry key indicating whether the Favorites have been added, check the key on initialize and add them accordingly. This way the favorites are added, but only for those who run your app.

          But, I'm guessing I'm rehashing your thoughts...

          Comment

          • Lorne
            Indigo Rose Staff Member
            • Feb 2001
            • 2729

            #6
            Re: %MyDocumentsDir%

            Case in point: my own My Documents folder is on another partition (D:\My Documents).
            --[[ Indigo Rose Software Developer ]]

            Comment

            Working...
            X