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. Changing directory in CFileDialog

Changing directory in CFileDialog

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • D Offline
    D Offline
    doctorpi
    wrote on last edited by
    #1

    Hi guys I'm trying to do a tricky thing with CFileDialog but I don't know how to do it. I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before. Ex: If I choose "*.mdb" files look for files on "c:\mdb" directory if I choose "*.txt" files go on "c:\txt" directory Is this possible? What I have to change? Thanks Doc

    C D 2 Replies Last reply
    0
    • D doctorpi

      Hi guys I'm trying to do a tricky thing with CFileDialog but I don't know how to do it. I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before. Ex: If I choose "*.mdb" files look for files on "c:\mdb" directory if I choose "*.txt" files go on "c:\txt" directory Is this possible? What I have to change? Thanks Doc

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      I think the best way to do it is to make your own file dialog that inherits from CFileDialog. Then you override the OnLBSelChangedNotify[^] function and in this function, you change the folder (for this part, I don't know exactly how to do it).

      1 Reply Last reply
      0
      • D doctorpi

        Hi guys I'm trying to do a tricky thing with CFileDialog but I don't know how to do it. I want that once the dialog is opened, when I change the type of the file, the directory where the CFileDialog class looks for the files change for one that I decided before. Ex: If I choose "*.mdb" files look for files on "c:\mdb" directory if I choose "*.txt" files go on "c:\txt" directory Is this possible? What I have to change? Thanks Doc

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        You could provide a hook procedure (see OFN_ENABLEHOOK) and look for the WM_NOTIFY message. On the other hand, this may not work to the extent that you desire. You can easily get the name of the selected file in the hook procedure. You could even go so far as to "click" the "Up One Level" button. You might even be able to plug a folder name into the edit control and "click" the "Open" button. Wouldn't hurt to try...


        "The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb

        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