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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DIrectoy selection, and creating

DIrectoy selection, and creating

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
8 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.
  • B Offline
    B Offline
    BoudewijnEctor
    wrote on last edited by
    #1

    Hi, I've created a directory selection dialog (thanks to some people here at CP), but I thought it's nice to have some of creating a folder from this dialog. I you can't, you have to creat one yourslef, using explorer. I know how to create a folder in MFC, but you can use that function from the dialog! Help me please,

    J 1 Reply Last reply
    0
    • B BoudewijnEctor

      Hi, I've created a directory selection dialog (thanks to some people here at CP), but I thought it's nice to have some of creating a folder from this dialog. I you can't, you have to creat one yourslef, using explorer. I know how to create a folder in MFC, but you can use that function from the dialog! Help me please,

      J Offline
      J Offline
      jhwurmbach
      wrote on last edited by
      #2

      Why can't you create a folder? What is happening?


      Who is 'General Failure'? And why is he reading my harddisk?!?

      B 1 Reply Last reply
      0
      • J jhwurmbach

        Why can't you create a folder? What is happening?


        Who is 'General Failure'? And why is he reading my harddisk?!?

        B Offline
        B Offline
        BoudewijnEctor
        wrote on last edited by
        #3

        No, I just need to get a button (called new directorie, or something) to create a new directory, without having to rewrite this diialog. So, do you know wether there is some kind of flag to enable this sort of feature?

        J 1 Reply Last reply
        0
        • B BoudewijnEctor

          No, I just need to get a button (called new directorie, or something) to create a new directory, without having to rewrite this diialog. So, do you know wether there is some kind of flag to enable this sort of feature?

          J Offline
          J Offline
          jhwurmbach
          wrote on last edited by
          #4

          What dialog are you using? A standard one or a homegrown dialog?


          Who is 'General Failure'? And why is he reading my harddisk?!?

          B 1 Reply Last reply
          0
          • J jhwurmbach

            What dialog are you using? A standard one or a homegrown dialog?


            Who is 'General Failure'? And why is he reading my harddisk?!?

            B Offline
            B Offline
            BoudewijnEctor
            wrote on last edited by
            #5

            Here's my code, it's very standard (got parts of it from people at CP:)) BROWSEINFO* b=new BROWSEINFO(); LPTSTR buf=new TCHAR[MAX_PATH]; int image=-1; b->hwndOwner=this->m_hWnd; b->iImage=image; b->lpszTitle="Please select a directory for your input:"; b->pidlRoot=NULL; b->pszDisplayName=buf; b->ulFlags=BIF_BROWSEINCLUDEFILES; LPITEMIDLIST x=SHBrowseForFolder(b); if(x==NULL) { return; } LPTSTR buf2=new TCHAR[MAX_PATH]; bool gelukt=SHGetPathFromIDList(x,buf2); CString pad=buf2; if(!gelukt) { error_scherm e; e.set_text("It seems that the directory you've selected is corrupt, if this problem persists please contact the developer."); e.DoModal(); return; } delete [] buf; // Delete the memory when you're finished with it. delete [] buf2;

            J 1 Reply Last reply
            0
            • B BoudewijnEctor

              Here's my code, it's very standard (got parts of it from people at CP:)) BROWSEINFO* b=new BROWSEINFO(); LPTSTR buf=new TCHAR[MAX_PATH]; int image=-1; b->hwndOwner=this->m_hWnd; b->iImage=image; b->lpszTitle="Please select a directory for your input:"; b->pidlRoot=NULL; b->pszDisplayName=buf; b->ulFlags=BIF_BROWSEINCLUDEFILES; LPITEMIDLIST x=SHBrowseForFolder(b); if(x==NULL) { return; } LPTSTR buf2=new TCHAR[MAX_PATH]; bool gelukt=SHGetPathFromIDList(x,buf2); CString pad=buf2; if(!gelukt) { error_scherm e; e.set_text("It seems that the directory you've selected is corrupt, if this problem persists please contact the developer."); e.DoModal(); return; } delete [] buf; // Delete the memory when you're finished with it. delete [] buf2;

              J Offline
              J Offline
              jhwurmbach
              wrote on last edited by
              #6

              You need to include the style BIF_NEWDIALOGSTYLE with your SHBrowseForFolder. simply AND it into the ulFlags: b->ulFlags=BIF_BROWSEINCLUDEFILES & BIF_NEWDIALOGSTYLE; You then get a slightly different dlg, but that is newer one.


              Who is 'General Failure'? And why is he reading my harddisk?!?

              B 1 Reply Last reply
              0
              • J jhwurmbach

                You need to include the style BIF_NEWDIALOGSTYLE with your SHBrowseForFolder. simply AND it into the ulFlags: b->ulFlags=BIF_BROWSEINCLUDEFILES & BIF_NEWDIALOGSTYLE; You then get a slightly different dlg, but that is newer one.


                Who is 'General Failure'? And why is he reading my harddisk?!?

                B Offline
                B Offline
                BoudewijnEctor
                wrote on last edited by
                #7

                Thanks, but this isn't working (altough i'm using win2k and the newest IDE (.NET 2003)), is there some other way to do this?

                J 1 Reply Last reply
                0
                • B BoudewijnEctor

                  Thanks, but this isn't working (altough i'm using win2k and the newest IDE (.NET 2003)), is there some other way to do this?

                  J Offline
                  J Offline
                  jhwurmbach
                  wrote on last edited by
                  #8

                  You can try this[^] article. Or this[^] one. Sorry, I do not have much time to help you today, but with reading MSDN, code examples from the links I gave and own experiments you should be able to force the 'New Dir' button on the folder open dlg.


                  Who is 'General Failure'? And why is he reading my harddisk?!?

                  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