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. I want the full path name.

I want the full path name.

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 1 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.
  • U Offline
    U Offline
    User 3512
    wrote on last edited by
    #1

    The following code will give me a dialog box that will allow a user to choose a directroy. It does return me the directory name, but I also need the full path to the directory. How do I get the full path to the directory?????? Thanks in advance. void CSwapObjectsView::DoDirectoryDialog(CString& strDir) { char szDisplayName[MAX_PATH] = ""; char szTitle[] = "Choose a directory"; BROWSEINFO x; memset(&x, NULL, sizeof(BROWSEINFO)); x.hwndOwner = this->m_hWnd; x.pszDisplayName = szDisplayName; x.lpszTitle = szTitle; x.ulFlags = BIF_RETURNONLYFSDIRS ; SHBrowseForFolder(&x);

    M 1 Reply Last reply
    0
    • U User 3512

      The following code will give me a dialog box that will allow a user to choose a directroy. It does return me the directory name, but I also need the full path to the directory. How do I get the full path to the directory?????? Thanks in advance. void CSwapObjectsView::DoDirectoryDialog(CString& strDir) { char szDisplayName[MAX_PATH] = ""; char szTitle[] = "Choose a directory"; BROWSEINFO x; memset(&x, NULL, sizeof(BROWSEINFO)); x.hwndOwner = this->m_hWnd; x.pszDisplayName = szDisplayName; x.lpszTitle = szTitle; x.ulFlags = BIF_RETURNONLYFSDIRS ; SHBrowseForFolder(&x);

      M Offline
      M Offline
      Mike Dunn
      wrote on last edited by
      #2

      Here's the bare-bones code to do it. Adding error handling is left as an exercise to the reader. ;)

      LPITEMIDLIST pidl;
      LPMALLOC pMalloc;
      TCHAR szDir[MAX_PATH];

      pidl = SHBrowseForFolder(&x);
      SHGetPathFromIDList ( pidl, szDir );

      SHGetMalloc(&pMalloc);
      pMalloc->Free(pidl);
      pMalloc->Release();

      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