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. MFC enlisting local drives

MFC enlisting local drives

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 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.
  • M Offline
    M Offline
    missnazar
    wrote on last edited by
    #1

    Hey I want to enlist local drives in combo box ...in similar way as in "Look in :" combo box of Search in Windows 2000 professional ....Does any one knows answer..? Drushti

    B M 2 Replies Last reply
    0
    • M missnazar

      Hey I want to enlist local drives in combo box ...in similar way as in "Look in :" combo box of Search in Windows 2000 professional ....Does any one knows answer..? Drushti

      B Offline
      B Offline
      BAIJUMAX
      wrote on last edited by
      #2

      hi, try this Code Add A Button [OpenFolder] Edit Box For display Selected File Path[IDC_EDIT_FILEPATH] -----------------In OnOpenFolderClick function----------- { LPITEMIDLIST pidlRoot = NULL; LPITEMIDLIST pidlSelected = NULL; BROWSEINFO bi = {0}; LPMALLOC pMalloc = NULL; TCHAR szDisplayName[MAX_PATH]; SHGetMalloc(&pMalloc); pidlRoot = NULL; bi.hwndOwner = m_hWnd; bi.pidlRoot = pidlRoot; bi.pszDisplayName = szDisplayName; bi.lpszTitle = "Choose a folder"; bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; bi.lpfn = BrowseCallbackProc; bi.lParam = 0; pidlSelected = SHBrowseForFolder(&bi); if(!pidlSelected) return; if(pidlRoot) { pMalloc->Free(pidlRoot); } pMalloc->Release(); SHGetPathFromIDList(pidlSelected,szDisplayName); GetDlgItem(IDC_EDIT_FILEPATH)->SetWindowText(szDisplayName); } --------------------------------------- ------add Below Code For Call Back Fuction. Above the function ----------------------------------------------- CString g_csDefaultPath = ""; INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg,LPARAM lp, LPARAM pData) { TCHAR szDir[MAX_PATH]; strcpy(szDir,(LPSTR)(LPCSTR)g_csDefaultPath); switch(uMsg) { case BFFM_INITIALIZED: //if (GetCurrentDirectory(sizeof(szDir)/sizeof(TCHAR), szDir)) { // WParam is TRUE since you are passing a path. // It would be FALSE if you were passing a pidl. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)szDir); } break; case BFFM_SELCHANGED: // Set the status window to the currently selected path. if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir)) { SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir); } break; } return 0; } by baijumax

      1 Reply Last reply
      0
      • M missnazar

        Hey I want to enlist local drives in combo box ...in similar way as in "Look in :" combo box of Search in Windows 2000 professional ....Does any one knows answer..? Drushti

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        Check out A Drop-Down-Listbox for Drives[^]Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot truly appreciate Dilbert unless you've read it in the original Klingon.

        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