Thread: create a dialog box to open folder: how to?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    12

    create a dialog box to open folder: how to?

    Hi!
    i wanna create a dialog box to open folder (when the user clicks on OK the box will give me the path).I know how to create a classic "open.." box with OPENFILENAME and GetOpenFilename but I want to do this with folders and I don't know how to.

    xcuse my mistakes but i'm not american or english

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    You'll have to look up SHBrowseForFolder(). Unfortunately, it's not as simple to use as the common control file open dialog, but if you do a search on MSDN you should find some example code.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    12
    thank you I think I can understand hiw it does work, but do you know which ".h" I have to add to use this function?

  4. #4
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Try shlobj.h.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    12
    So it does work!! Thank you!!

    But now I've the path, I want to have a list of files and folders in that path. I've searched in the msdn of course and I'm my docs but no way. Does someone know how to do that?

  6. #6
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    I'm not sure if there is a specific function, but you could recursively use FindFirstFile() and FindNextFile() for all files and directories starting at the path obtained from SHBrowseForFolder().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dialog box problem keeps haunting me
    By Bleech in forum Windows Programming
    Replies: 2
    Last Post: 08-23-2006, 01:12 AM
  2. Display Dialog Box Then Execute
    By stickman in forum C++ Programming
    Replies: 17
    Last Post: 05-10-2006, 11:02 AM
  3. Making dialog box the only window
    By PJYelton in forum Windows Programming
    Replies: 2
    Last Post: 09-06-2005, 12:02 PM
  4. Dialog Box & Property Sheet :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 08-01-2002, 01:33 PM
  5. SDI Menu App - MSVC 6
    By Unregistered in forum Windows Programming
    Replies: 7
    Last Post: 10-16-2001, 09:59 PM