Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. determing the full name to My Music on the start menu

determing the full name to My Music on the start menu

Scheduled Pinned Locked Moved C#
questiontutorial
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason Coggins
    wrote on last edited by
    #1

    On Windows when you press the start button (lower left corner) one of the entries that comes up is "my music." Part of this folders name includes the user name. For example in the following path "C:/Documents and Settings/john smith/My Documents/My Music" john smith is the user name. Since this part of the name will vary from user to user how can I open this folder on different computers with the same program? Jason

    M E D L 4 Replies Last reply
    0
    • J Jason Coggins

      On Windows when you press the start button (lower left corner) one of the entries that comes up is "my music." Part of this folders name includes the user name. For example in the following path "C:/Documents and Settings/john smith/My Documents/My Music" john smith is the user name. Since this part of the name will vary from user to user how can I open this folder on different computers with the same program? Jason

      M Offline
      M Offline
      mr mohsen
      wrote on last edited by
      #2

      you should to use dynamic USERNAME instead of john smith. then you have to determine the USER NAME of current user programmatically. its too easy. just search in google.

      nobody help you... you have to help you yourself and this is success way.

      1 Reply Last reply
      0
      • J Jason Coggins

        On Windows when you press the start button (lower left corner) one of the entries that comes up is "my music." Part of this folders name includes the user name. For example in the following path "C:/Documents and Settings/john smith/My Documents/My Music" john smith is the user name. Since this part of the name will vary from user to user how can I open this folder on different computers with the same program? Jason

        E Offline
        E Offline
        Ed Poore
        wrote on last edited by
        #3

        You're going to be treading in "murky" waters because on Vista the whole naming convention has changed.  For example "My Documents" is now called "Documents" and is located:

        "C:\Users\USERNAME\Documents" rather than "C:\Documents and Settings\USERNAME\My Documents"

        The Desktop:

        "C:\Users\USERNAME\Desktop" rather than "C:\Documents and Settings\USERNAME\Desktop"

        1 Reply Last reply
        0
        • J Jason Coggins

          On Windows when you press the start button (lower left corner) one of the entries that comes up is "my music." Part of this folders name includes the user name. For example in the following path "C:/Documents and Settings/john smith/My Documents/My Music" john smith is the user name. Since this part of the name will vary from user to user how can I open this folder on different computers with the same program? Jason

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          Environment.GetFolderPath(Environment.SpecialFolder.MyMusic); will return a string with the full path of the current user's My Music folder

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

          1 Reply Last reply
          0
          • J Jason Coggins

            On Windows when you press the start button (lower left corner) one of the entries that comes up is "my music." Part of this folders name includes the user name. For example in the following path "C:/Documents and Settings/john smith/My Documents/My Music" john smith is the user name. Since this part of the name will vary from user to user how can I open this folder on different computers with the same program? Jason

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Dave is right, For all those special folders you may be interested in, use Environment.GetFolderPath() and Environment.SpecialFolder enumeration They keep moving these things around from one Windows version to the next, so it really is the only way to make it portable. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            Voting for dummies? No thanks. X|


            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups