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. PIDL of a selected file

PIDL of a selected file

Scheduled Pinned Locked Moved C / C++ / MFC
6 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.
  • R Offline
    R Offline
    ragavan
    wrote on last edited by
    #1

    Hi I have written an application which i am using to find the file opened through the Open/Save As dialog box. I am able to get only the file name which is opened. Is it possible to get the full path of the file from the file name. Is there anyway by which i can get the PIDL of a selected file in the dialog. Thanks in advance.

    S PJ ArendsP 2 Replies Last reply
    0
    • R ragavan

      Hi I have written an application which i am using to find the file opened through the Open/Save As dialog box. I am able to get only the file name which is opened. Is it possible to get the full path of the file from the file name. Is there anyway by which i can get the PIDL of a selected file in the dialog. Thanks in advance.

      S Offline
      S Offline
      swaapu
      wrote on last edited by
      #2

      Yes, u can get the full path of the file by using this function. to display the full path: SHGetPathFromIDList This function converts an item identifier list to a file system path. WINSHELLAPI BOOL WINAPI SHGetPathFromIDList( LPCITEMIDLIST pidl, LPSTR pszPath ); Parameters pidl [in] Pointer to an item identifier list that specifies a file or directory location relative to the root of the namespace (the desktop). pszPath [out] Pointer to a buffer to receive the file system path. This buffer must be at least MAX_PATH characters in size. Return Values TRUE indicates success. FALSE indicates failure. Remarks If the location specified by the pidl parameter is not part of the file system, this function will fail. "If you change then change for the good."

      R 1 Reply Last reply
      0
      • S swaapu

        Yes, u can get the full path of the file by using this function. to display the full path: SHGetPathFromIDList This function converts an item identifier list to a file system path. WINSHELLAPI BOOL WINAPI SHGetPathFromIDList( LPCITEMIDLIST pidl, LPSTR pszPath ); Parameters pidl [in] Pointer to an item identifier list that specifies a file or directory location relative to the root of the namespace (the desktop). pszPath [out] Pointer to a buffer to receive the file system path. This buffer must be at least MAX_PATH characters in size. Return Values TRUE indicates success. FALSE indicates failure. Remarks If the location specified by the pidl parameter is not part of the file system, this function will fail. "If you change then change for the good."

        R Offline
        R Offline
        ragavan
        wrote on last edited by
        #3

        Thanks . But that function will convert the PIDL to a path. My question is how to get the PIDL of a selected file.

        S 1 Reply Last reply
        0
        • R ragavan

          Thanks . But that function will convert the PIDL to a path. My question is how to get the PIDL of a selected file.

          S Offline
          S Offline
          swaapu
          wrote on last edited by
          #4

          Hi!! Go through Q167834. U will definitely get some hint from there. "If you change then change for the good."

          1 Reply Last reply
          0
          • R ragavan

            Hi I have written an application which i am using to find the file opened through the Open/Save As dialog box. I am able to get only the file name which is opened. Is it possible to get the full path of the file from the file name. Is there anyway by which i can get the PIDL of a selected file in the dialog. Thanks in advance.

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

            If you are using CFileDialog, call CFileDialog::GetPathName() for the complete path to the selected file. If you are not using MFC then OPENFILENAME::lpstrFile will contain the complete path to the file.


            "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

            Within you lies the power for good; Use it!

            R 1 Reply Last reply
            0
            • PJ ArendsP PJ Arends

              If you are using CFileDialog, call CFileDialog::GetPathName() for the complete path to the selected file. If you are not using MFC then OPENFILENAME::lpstrFile will contain the complete path to the file.


              "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

              R Offline
              R Offline
              ragavan
              wrote on last edited by
              #6

              That is true. But i want the file name from Open/Save as dialog of MS-Office or Notepad

              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