3/13/2014

C, C++, To select a file and get path and file name using CFileDialog function, example source code

TCHAR szFilter[] = _T("All Files(*.*)|*.*||");
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter);

CString strPathName, m_filename;
if(IDOK == dlg.DoModal()) {
 m_filename=dlg.GetFileName();   //file name
 strPathName = dlg.GetPathName(); //full path info
}

..



No comments:

Post a Comment