I am using CFileDialog, I have set the initial path like below , as shown in the code. It's not working . Correct me if I made a mistake.
CFileDialog* filedlg = new CFileDialog(TRUE,(LPCTSTR)NULL , (LPCTSTR)NULL , OFN_HIDEREADONLY| OFN_ENABLESIZING , (LPCTSTR)NULL , FromHandle (hImgDlg) ,0 , FALSE );
filedlg ->m_ofn.lpstrInitialDir = "C:\\" ;
if ( filedlg ->DoModal() == IDOK )
{
/*** do somthing here *****/
}
If you see the reference for the OPENFILENAME
structure, you will see that for the lpstrInitialDir
field it states that:
If
lpstrInitialDir
has the same value as was passed the first time the application used anOpen
orSave As
dialog box, the path most recently selected by the user is used as the initial directory.
This means that the lpstrInitialDir
field can really only be used the first time you use the dialog in a program. The rest of the time it will use the last directory selected by the user.