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. Setting default directory for OnFileOpen

Setting default directory for OnFileOpen

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

    Hi, I have SDI app that load files through CWinApp::OnFileOpen. When the file dialog opens it is in the last opened directory. Normally this is the wrong directory.:( When My program starts and File open is selected I want it to open in my default directory. How can I set this without overriding OnFileOpen and using a CFileDialog :confused: Thanks ---

    M 1 Reply Last reply
    0
    • C Coremn

      Hi, I have SDI app that load files through CWinApp::OnFileOpen. When the file dialog opens it is in the last opened directory. Normally this is the wrong directory.:( When My program starts and File open is selected I want it to open in my default directory. How can I set this without overriding OnFileOpen and using a CFileDialog :confused: Thanks ---

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You could override CDocManager::DoPromptFileName, but bear in mind that CDocManager is an undocumented class and could change. Note that Windows itself is providing this default behaviour, which users may have come to expect from their other applications. See the documentation for the OPENFILENAME structure's lpstrInitialDir member (MSDN Library[^]). Stability. What an interesting concept. -- Chris Maunder

      C 1 Reply Last reply
      0
      • M Mike Dimmick

        You could override CDocManager::DoPromptFileName, but bear in mind that CDocManager is an undocumented class and could change. Note that Windows itself is providing this default behaviour, which users may have come to expect from their other applications. See the documentation for the OPENFILENAME structure's lpstrInitialDir member (MSDN Library[^]). Stability. What an interesting concept. -- Chris Maunder

        C Offline
        C Offline
        Coremn
        wrote on last edited by
        #3

        Mike Dimmick wrote: You could override CDocManager::DoPromptFileName Yep thats what I have done, and that works fine (as long as CDocManager doesnt change) Thanks ---

        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