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. CFileDialog change directory?

CFileDialog change directory?

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiongraphicstutorial
3 Posts 2 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.
  • E Offline
    E Offline
    electronicman_x
    wrote on last edited by
    #1

    This is for an MDI program (mfc) with visual c++ 6.0 Probably a pretty easy question: I am using CFileDialog for open/save as file operations. I want to be able to create an instance of the dialog, change the working directory in code at runtime, and then domodal() having the dialog show the directory i specified as the current directory. I'm able to get the directory names i want to use in the format CString (i.e. "c:\project\dbc") and i want to use this path/directory string to change the directory but i can't seem to figure out how to do it. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

    B 1 Reply Last reply
    0
    • E electronicman_x

      This is for an MDI program (mfc) with visual c++ 6.0 Probably a pretty easy question: I am using CFileDialog for open/save as file operations. I want to be able to create an instance of the dialog, change the working directory in code at runtime, and then domodal() having the dialog show the directory i specified as the current directory. I'm able to get the directory names i want to use in the format CString (i.e. "c:\project\dbc") and i want to use this path/directory string to change the directory but i can't seem to figure out how to do it. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

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

      You need to set the lpstrInitialDir member of the OPENFILENAME member struct (m_ofn) in the CFileDialog class. See the doc for more info.  onwards and upwards...

      E 1 Reply Last reply
      0
      • B basementman

        You need to set the lpstrInitialDir member of the OPENFILENAME member struct (m_ofn) in the CFileDialog class. See the doc for more info.  onwards and upwards...

        E Offline
        E Offline
        electronicman_x
        wrote on last edited by
        #3

        Thanks, that works great. I must have missed that m_ofn data item. Jeff Rothenberg Project Engineer Vector CANtech, Inc.

        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