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. Shell doesnt give long filename

Shell doesnt give long filename

Scheduled Pinned Locked Moved C / C++ / MFC
linuxworkspace
5 Posts 3 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.
  • K Offline
    K Offline
    KnaveWave
    wrote on last edited by
    #1

    Im trying to setup my app so that when a user right clicks on a associated file type then selects "run with myApp" itll open my app passing the files full path. Ive tried getCommandLine() and directly accessing m_lpCmdLine but both of these return the short file name.

    O 1 Reply Last reply
    0
    • K KnaveWave

      Im trying to setup my app so that when a user right clicks on a associated file type then selects "run with myApp" itll open my app passing the files full path. Ive tried getCommandLine() and directly accessing m_lpCmdLine but both of these return the short file name.

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

      I'm not certain how do do exactly what you want, but couldn't you call GetLongPathName function once you know the short filename and convert it to the long name?

      T K 2 Replies Last reply
      0
      • O OBRon

        I'm not certain how do do exactly what you want, but couldn't you call GetLongPathName function once you know the short filename and convert it to the long name?

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

        Unless he's calling a "short file name" just the "file name" as in x.exe. I've seen this that sometimes you get a full path in the command line and sometimes you just get the exe name. If you want to get the path to the current executable, which is what you want? You don't want to trust the command line. To get the path to the location of the exectuable (or DLL) use "GetModuleFileName" or "GetModuleFileNameEx". Those should get you the path to the executable.

        1 Reply Last reply
        0
        • O OBRon

          I'm not certain how do do exactly what you want, but couldn't you call GetLongPathName function once you know the short filename and convert it to the long name?

          K Offline
          K Offline
          KnaveWave
          wrote on last edited by
          #4

          Thank you very much! GetLongPathName was exactly what i needed. Just out of curiosity, do you have any idea why id be getting a short filename? I manually setup the registry so that when someone right clicked on the file type it ran my program and passed the file as a parameter. Whenever my program would get the command line data itd be in the form: and by short path i mean the old school dos type w/ ~'s in the path

          O 1 Reply Last reply
          0
          • K KnaveWave

            Thank you very much! GetLongPathName was exactly what i needed. Just out of curiosity, do you have any idea why id be getting a short filename? I manually setup the registry so that when someone right clicked on the file type it ran my program and passed the file as a parameter. Whenever my program would get the command line data itd be in the form: and by short path i mean the old school dos type w/ ~'s in the path

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

            Glad the workaround worked for you. I'm sorry I don't know the proper way to do this...I haven't done any shell programming at all. I did find this article on the codeguru; not that I recommend or endorse the codeguru in any way - seeing that I'm a loyal codeproject user: http://www.codeguru.com/Cpp/COM-Tech/shell/article.php/c1315/

            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