Changing the current directory with the help of dialog window(MFC

G

Guest

Changing the current directory with the help of dialog window(MFC app)
We can change directory with the help of the following code:
CFileDialog m_ldFile(TRUE);
m_ldFile.m_ofn.lpstrInitialDir="c:\\"; // the initial folder.
//below the dialog window is opened, then tfolders and eventually a file
and after automatically current directory is changed .
if(m_ldFile.DoModal()==IDOK)
{
//below finding out the path.
m_strPath=m_ldFile.GetPathName();
UpdateData(FALSE);
}
We don't need to open a file, but only a folder, in order to change
current directory.
Could you explain please, how I can change current directory without
opening file.
Alur.
 
S

Steve Alpert

Alur said:
Changing the current directory with the help of dialog window(MFC app)
We can change directory with the help of the following code:
CFileDialog m_ldFile(TRUE);
m_ldFile.m_ofn.lpstrInitialDir="c:\\"; // the initial folder.
//below the dialog window is opened, then tfolders and eventually a file
and after automatically current directory is changed .
if(m_ldFile.DoModal()==IDOK)
{
//below finding out the path.
m_strPath=m_ldFile.GetPathName();
UpdateData(FALSE);
}
We don't need to open a file, but only a folder, in order to change
current directory.
Could you explain please, how I can change current directory without
opening file.
Alur.

Try looking at SHBrowseForFolder()

/steveA
 
S

stureby

Hi Guys

What if I dont want to change the current directory when I ope
FileDialog...


Thank


-
stureb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top