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. to create a browse button to display path of file using mfc dialog box

to create a browse button to display path of file using mfc dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
2 Posts 2 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.
  • S Offline
    S Offline
    shiva shankar
    wrote on last edited by
    #1

    plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++

    2 1 Reply Last reply
    0
    • S shiva shankar

      plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++

      2 Offline
      2 Offline
      224917
      wrote on last edited by
      #2

      shiva shankar wrote: plz can any one help me in creating a dialog box with browse button to display path of the files in mfc i,e vc++ LPMALLOC pMalloc; /* Gets the Shell's default allocator */ if (::SHGetMalloc(&pMalloc) == NOERROR) { BROWSEINFO bi; char pszBuffer[MAX_PATH]; LPITEMIDLIST pidl; // Get help on BROWSEINFO struct - it's got all the bit settings. bi.hwndOwner = GetSafeHwnd(); bi.pidlRoot = NULL; bi.pszDisplayName = pszBuffer; bi.lpszTitle = _T("Select a Starting Directory"); bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; bi.lpfn = NULL; bi.lParam = 0; // This next call issues the dialog box. if ((pidl = ::SHBrowseForFolder(&bi)) != NULL) { if (::SHGetPathFromIDList(pidl, pszBuffer)) { // At this point pszBuffer contains the selected path */. DoingSomethingUseful(pszBuffer); } // Free the PIDL allocated by SHBrowseForFolder. pMalloc->Free(pidl); } // Release the shell's allocator. pMalloc->Release(); }


      It's not a bug, it's an undocumented feature.
      suhredayan@omniquad.com

      messenger :suhredayan@hotmail.com

      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