Setting default directory for OnFileOpen
-
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 ---
-
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 ---
You could override
CDocManager::DoPromptFileName
, but bear in mind thatCDocManager
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 theOPENFILENAME
structure'slpstrInitialDir
member (MSDN Library[^]). Stability. What an interesting concept. -- Chris Maunder -
You could override
CDocManager::DoPromptFileName
, but bear in mind thatCDocManager
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 theOPENFILENAME
structure'slpstrInitialDir
member (MSDN Library[^]). Stability. What an interesting concept. -- Chris Maunder