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. C / C++ / MFC
  3. CFileDialog Default Directory

CFileDialog Default Directory

Scheduled Pinned Locked Moved C / C++ / MFC
4 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.
  • R Offline
    R Offline
    Ron Ginsberg
    wrote on last edited by
    #1

    I need to set the default file open folder for open file in a doc/view/mdi app. I know about the win32 api structure containing an initial folder parameter. The file is serialized. Do I have to completely subclass the dialog or is there a way to modify that structure variable capturing the menu message on File Open and then pass to the standard CFileOpen without rewriting all of it? Also, what module (MainFrame, ChildFrame, etc, do I capture the message and set the initial folder variable, then pass on to the standard function? I do not want to start in My Documents but will load the default path from a parameter I've stored successfully in the registry. This is a multi-template app depending on file extension, but for now all the files will be stored in one default folder. Nothing to set in the menu resource string tables for this?

    M 1 Reply Last reply
    0
    • R Ron Ginsberg

      I need to set the default file open folder for open file in a doc/view/mdi app. I know about the win32 api structure containing an initial folder parameter. The file is serialized. Do I have to completely subclass the dialog or is there a way to modify that structure variable capturing the menu message on File Open and then pass to the standard CFileOpen without rewriting all of it? Also, what module (MainFrame, ChildFrame, etc, do I capture the message and set the initial folder variable, then pass on to the standard function? I do not want to start in My Documents but will load the default path from a parameter I've stored successfully in the registry. This is a multi-template app depending on file extension, but for now all the files will be stored in one default folder. Nothing to set in the menu resource string tables for this?

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

      After constructing your CFileDialog, just change the m_ofn member as appropriate before calling DoModal(). --Mike-- http://home.inreach.com/mdunn/

      R 1 Reply Last reply
      0
      • M Michael Dunn

        After constructing your CFileDialog, just change the m_ofn member as appropriate before calling DoModal(). --Mike-- http://home.inreach.com/mdunn/

        R Offline
        R Offline
        Ron Ginsberg
        wrote on last edited by
        #3

        but can I catch this in the framework without subclassing the entire file open? In the doc On Open? elsewhere in the wiz generated doc/view?

        B 1 Reply Last reply
        0
        • R Ron Ginsberg

          but can I catch this in the framework without subclassing the entire file open? In the doc On Open? elsewhere in the wiz generated doc/view?

          B Offline
          B Offline
          Berkut
          wrote on last edited by
          #4

          Hi, You can do it by changing the members of your CFileDialog before calling DoModal() : CFileDialog(TRUE, .......); dlg.m_ofn = ... if (dlg.DoModal() == IDOK) { // Do Open thing here } Hope this helps, Berkut

          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