I want the CFileDialog dialog to be looking at a predetermine folder whenit first opens instead of the folder that the application is running. How do I do that.
Thanks
Jim Bassett
Printable View
I want the CFileDialog dialog to be looking at a predetermine folder whenit first opens instead of the folder that the application is running. How do I do that.
Thanks
Jim Bassett
hai,
CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );
while creating a object for CFiledialog the third parameter in the constructor
you pass you can give the path you required to come when the file dialog
pops up.
satish
Hi!
CFileDialog::m_ofn is a structure of type OPENFILENAME. Use this structure to initialize the appearance of a File Open or File Save As dialog box after it is constructed but before it is displayed with the DoModal member function. You can set the lpstrInitialDir member of m_ofn to the directory you want the dialog box to point to initially.
The following code shd solve your problem :
CFileDialog FilePath(TRUE);
FilePath.m_ofn.lpstrInitialDir = "D:\\"; //Set the value of lpstrInitialDir to the predeterminate folder U want it to point to.
FilePath.DoModal();
Do let me know if it works.
Regards,
Sukanya Swaminathan
Software Engineer
Aditi Technologies
Blr - 80
Email :[email protected]