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 folder of current application

Get the folder of current application

Scheduled Pinned Locked Moved C / C++ / MFC
jsonquestion
9 Posts 7 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
    Lost User
    wrote on last edited by
    #1

    Hello guys, Is there any API, which will return the full path of the folder from where my application is running ? Like GetModuleFilename() API , - but it returns the fullpath , including the filename. thanks


    "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
    -- modified at 15:24 Monday 24th October, 2005

    G T V 3 Replies Last reply
    0
    • L Lost User

      Hello guys, Is there any API, which will return the full path of the folder from where my application is running ? Like GetModuleFilename() API , - but it returns the fullpath , including the filename. thanks


      "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
      -- modified at 15:24 Monday 24th October, 2005

      G Offline
      G Offline
      Ghasrfakhri
      wrote on last edited by
      #2

      Hi You can extract Path easily, Like GetModuleFileName(NULL,m_CurrentPath.GetBuffer(512),512); m_CurrentPath.ReleaseBuffer(); m_CurrentPath.Delete(m_CurrentPath.ReverseFind('\\'),m_CurrentPath.GetLength()-m_CurrentPath.ReverseFind('\\')); Iman Ghasrfakhri

      L 1 Reply Last reply
      0
      • G Ghasrfakhri

        Hi You can extract Path easily, Like GetModuleFileName(NULL,m_CurrentPath.GetBuffer(512),512); m_CurrentPath.ReleaseBuffer(); m_CurrentPath.Delete(m_CurrentPath.ReverseFind('\\'),m_CurrentPath.GetLength()-m_CurrentPath.ReverseFind('\\')); Iman Ghasrfakhri

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Ghasrfakhri wrote:

        You can extract Path easily, Like

        I know , but I am interested if there is a API function which will do this


        "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill

        B T 2 Replies Last reply
        0
        • L Lost User

          Ghasrfakhri wrote:

          You can extract Path easily, Like

          I know , but I am interested if there is a API function which will do this


          "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill

          B Offline
          B Offline
          Blake Miller
          wrote on last edited by
          #4

          PathRemoveFileSpec Function Removes the trailing file name and backslash from a path, if it has them. BOOL PathRemoveFileSpec(LPTSTR pszPath);

          1 Reply Last reply
          0
          • L Lost User

            Hello guys, Is there any API, which will return the full path of the folder from where my application is running ? Like GetModuleFilename() API , - but it returns the fullpath , including the filename. thanks


            "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
            -- modified at 15:24 Monday 24th October, 2005

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #5

            Giorgi Moniava wrote:

            Like GetModuleFilename() API , - but it returns the fullpath , including the filename.

            Hi Giorgi, AFAIK, There is no such Api to Reterive Folder name only, you have to manually parse the FolderName ! :)

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta VC Forum Q&A :- I/ IV

            1 Reply Last reply
            0
            • L Lost User

              Hello guys, Is there any API, which will return the full path of the folder from where my application is running ? Like GetModuleFilename() API , - but it returns the fullpath , including the filename. thanks


              "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
              -- modified at 15:24 Monday 24th October, 2005

              V Offline
              V Offline
              vikas amin
              wrote on last edited by
              #6

              hi Giorgi Moniava Yeh alok is right as far as i know there is no such API availabe in VC6 thank you Vikas Amin Embin Technology Bombay vikas.amin@embin.com

              1 Reply Last reply
              0
              • L Lost User

                Ghasrfakhri wrote:

                You can extract Path easily, Like

                I know , but I am interested if there is a API function which will do this


                "Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                as Blake Miller explained, PathRemoveFileSpec() exists for that but hey, look, it certainly does what one presented you before (with the reverse string search), and calling it will only slow your prgram down because of an added function call...


                TOXCCT >>> GEII power
                [toxcct][VisualCalc]

                D 1 Reply Last reply
                0
                • T toxcct

                  as Blake Miller explained, PathRemoveFileSpec() exists for that but hey, look, it certainly does what one presented you before (with the reverse string search), and calling it will only slow your prgram down because of an added function call...


                  TOXCCT >>> GEII power
                  [toxcct][VisualCalc]

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  toxcct wrote:

                  PathRemoveFileSpec() exists...and calling it will only slow your prgram down...

                  Slower compared to what?


                  "Take only what you need and leave the land as you found it." - Native American Proverb

                  T 1 Reply Last reply
                  0
                  • D David Crow

                    toxcct wrote:

                    PathRemoveFileSpec() exists...and calling it will only slow your prgram down...

                    Slower compared to what?


                    "Take only what you need and leave the land as you found it." - Native American Proverb

                    T Offline
                    T Offline
                    toxcct
                    wrote on last edited by
                    #9

                    compared to when you do the same thing without a function call...


                    TOXCCT >>> GEII power
                    [toxcct][VisualCalc]

                    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