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 / C++ / MFC
  4. Get the program folder

Get the program folder

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 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.
  • L Offline
    L Offline
    Larsson
    wrote on last edited by
    #1

    How can I get the program folder?

    O T T PJ ArendsP 4 Replies Last reply
    0
    • L Larsson

      How can I get the program folder?

      O Offline
      O Offline
      OBRon
      wrote on last edited by
      #2

      I don't know if there's an actual API call on this or not, but you can always pluck this out of the registry. It's always in the same place on any version of Windows: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir -OBRon

      L 1 Reply Last reply
      0
      • O OBRon

        I don't know if there's an actual API call on this or not, but you can always pluck this out of the registry. It's always in the same place on any version of Windows: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir -OBRon

        L Offline
        L Offline
        Larsson
        wrote on last edited by
        #3

        Thanks, I think it will work but it will be more code but thats ok.

        1 Reply Last reply
        0
        • L Larsson

          How can I get the program folder?

          T Offline
          T Offline
          Tom Wright
          wrote on last edited by
          #4

          Do you mean the program files folder? or the folder that your program is running from? Tom Wright tawright915@yahoo.com

          L 1 Reply Last reply
          0
          • T Tom Wright

            Do you mean the program files folder? or the folder that your program is running from? Tom Wright tawright915@yahoo.com

            L Offline
            L Offline
            Larsson
            wrote on last edited by
            #5

            The Program files folder.

            T 1 Reply Last reply
            0
            • L Larsson

              How can I get the program folder?

              T Offline
              T Offline
              Toby Opferman
              wrote on last edited by
              #6

              Have you tried looking at the SHGetFolderPath(), SHGetFolderLocation(), SH* functions?

              1 Reply Last reply
              0
              • L Larsson

                The Program files folder.

                T Offline
                T Offline
                Tom Wright
                wrote on last edited by
                #7

                The problem is that the program files folder can be on several drives. I have MS office installed on my D drive and the installer created a program files folder by default. You'd have to search all fixed drives to make sure that it does not exists on any of them. Tom Wright tawright915@yahoo.com

                1 Reply Last reply
                0
                • L Larsson

                  How can I get the program folder?

                  PJ ArendsP Offline
                  PJ ArendsP Offline
                  PJ Arends
                  wrote on last edited by
                  #8

                  GetModuleFileName()


                  [

                  ](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

                  Within you lies the power for good; Use it!

                  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