Posted By

bits on 02/11/11


Tagged

CFileDialog


Versions (?)

CFileDialog with Directory preset


 / Published in: C++
 

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

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

  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. }

Report this snippet  

You need to login to post a comment.