CFileDialog with Directory preset


/ Published in: C++
Save to your folder(s)

This shows how to define the directory where the MFC file dialog should start.


Copy this code and paste it in your HTML
  1. CFileDialog m_idFile( true, "exe", NULL, OFN_HIDEREADONLY,
  2. "Executables (*.exe)|*.exe|", AfxGetMainWnd());
  3.  
  4. // here comes the important line
  5. m_idFile.m_ofn.lpstrInitialDir = "C:\\winnt";
  6.  
  7. if (m_idFile.DoModal()==IDOK)
  8. {
  9. //yadayada..
  10. }

URL: http://www.codeguru.com/forum/archive/index.php/t-146039.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.